1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-04 20:40:57 +02:00
zsh/Completion/Unix/Command/_unexpand
Oliver Kiddle 1a3a07a35f 41849: handle both unexpand and expand in a single function
They have some commonalities and using _unexpand dodges around
the clash with the _expand completer.
2017-10-11 01:23:56 +02:00

33 lines
945 B
Text

#compdef unexpand gunexpand expand gexpand
local all tabs
local -a args
all="convert all whitespace, instead of just initial whitespace"
tabs="[use comma separated list of tab positions]:list of tab positions"
if _pick_variant gnu="Free Soft" unix --version; then
if [[ $service = *un* ]]; then
args=(
"(-a --help --version)--all[$all]"
'(--help --version)--first-only[convert only leading sequences of whitespace]'
)
else
args=(
'(-i --initial --help --version)'{-i,--initial}"[don't convert tabs after non blanks]"
)
fi
args+=(
"(-t --help --version)--tabs=${tabs}"
'(* -)--help[display usage information]'
'(* -)--version[display version information]'
)
elif [[ $OSTYPE = (*bsd*|dragonfly*|darwin*) ]]; then
args=( -A "-*" )
fi
[[ $service = *un* ]] && args+=( "(--all --help --version)-a[$all]" )
_arguments -s -S "$args[@]" \
"(--tabs --help)-t+${tabs}" \
'*:file:_files'