shitbox/pkg/usr/share/zsh/site-functions/_cut

44 lines
1.0 KiB
Plaintext

#compdef cut
autoload -U is-at-least
_cut() {
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[@]}" \
'-b+[select only these bytes]:LIST: ' \
'--bytes=[select only these bytes]:LIST: ' \
'-c+[select only these characters]:LIST: ' \
'--characters=[select only these characters]:LIST: ' \
'-f+[select only these fields]:LIST: ' \
'--fields=[select only these fields]:LIST: ' \
'-d+[use DELIM instead of TAB for field delimiter]:DELIM: ' \
'--delimiter=[use DELIM instead of TAB for field delimiter]:DELIM: ' \
'-n+[ignored]: : ' \
'-s[]' \
'--only-delimited[]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
'*::file:' \
&& ret=0
}
(( $+functions[_cut_commands] )) ||
_cut_commands() {
local commands; commands=()
_describe -t commands 'cut commands' commands "$@"
}
_cut "$@"