1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-07-09 16:11:27 +02:00
zsh/Completion/Unix/Command/_wc
Oliver Kiddle ab7ec8d985 35011: update completions for some common Unix commands,
in particular improving FreeBSD support
2015-05-03 16:53:57 +02:00

26 lines
793 B
Text

#compdef wc gwc
local args
args=(
'(-c --bytes)'{-c,--bytes}'[print byte counts]'
'(-C -m --chars)'{-m,--chars}'[print character counts]'
'(-w --words)'{-w,--words}'[print word counts]'
'(-l --lines)'{-l,--lines}'[print line counts]'
)
if _pick_variant gnu=GNU unix --version; then
args+=(
'(*)--files0-from=[read NUL-terminated file list from specified file]:file:_files'
'(-L --max-line-length)'{-L,--max-line-length}'[print longest line lengths]'
)
else
args=( -A "-*" "${(@)args:#(|\(*\))(|\*)--*}" )
case $OSTYPE in
freebsd*|netbsd*) args+=( '-L[print longest line lengths]' ) ;;
openbsd*) args+=( '-h[human readable: use unit suffixes]' ) ;;
solaris*) args+=( ${${(M)args:#*-m\[*}//-m\[/-C\[} ) ;;
esac
fi
_arguments -s -S $args '*:file:_files'