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

43 lines
997 B
Plaintext

#compdef wc
autoload -U is-at-least
_wc() {
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[@]}" \
'-c[Print the byte counts]' \
'--bytes[Print the byte counts]' \
'-m[Print the character counts]' \
'--chars[Print the character counts]' \
'-l[Print the line counts]' \
'--lines[Print the line counts]' \
'-L[Print the maximum display width]' \
'--max-line-length[Print the maximum display width]' \
'-w[Print the word counts]' \
'--words[Print the word counts]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
'*::INPUT -- The input file to use:' \
&& ret=0
}
(( $+functions[_wc_commands] )) ||
_wc_commands() {
local commands; commands=()
_describe -t commands 'wc commands' commands "$@"
}
_wc "$@"