39 lines
955 B
Plaintext
39 lines
955 B
Plaintext
#compdef fold
|
|
|
|
autoload -U is-at-least
|
|
|
|
_fold() {
|
|
typeset -A opt_args
|
|
typeset -a _arguments_options
|
|
local ret=1
|
|
|
|
if is-at-least 5.2; then
|
|
_arguments_options=(-s -S -C)
|
|
else
|
|
_arguments_options=(-s -C)
|
|
fi
|
|
|
|
local context curcontext="$curcontext" state line
|
|
_arguments "${_arguments_options[@]}" \
|
|
'-w+[Use width columns]: : ' \
|
|
'--width=[Use width columns]: : ' \
|
|
'-b[Count bytes rather than columns]' \
|
|
'--bytes[Count bytes rather than columns]' \
|
|
'-s[Break at spaces]' \
|
|
'--spaces[Break at spaces]' \
|
|
'(-b --bytes -s --spaces)-o[Optimal fit]' \
|
|
'(-b --bytes -s --spaces)--optimal[Optimal fit]' \
|
|
'-h[Print help (see more with '\''--help'\'')]' \
|
|
'--help[Print help (see more with '\''--help'\'')]' \
|
|
'*::FILE -- The input file to use:' \
|
|
&& ret=0
|
|
}
|
|
|
|
(( $+functions[_fold_commands] )) ||
|
|
_fold_commands() {
|
|
local commands; commands=()
|
|
_describe -t commands 'fold commands' commands "$@"
|
|
}
|
|
|
|
_fold "$@"
|