diff options
Diffstat (limited to 'Completion/Unix/Command/_unexpand')
-rw-r--r-- | Completion/Unix/Command/_unexpand | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/Completion/Unix/Command/_unexpand b/Completion/Unix/Command/_unexpand index c983c628f..b548b3c3a 100644 --- a/Completion/Unix/Command/_unexpand +++ b/Completion/Unix/Command/_unexpand @@ -1,26 +1,37 @@ -#compdef unexpand +#compdef unexpand gunexpand expand gexpand -local all tabs ret=1 +local all tabs local -a args all="convert all whitespace, instead of just initial whitespace" -tabs="use comma separated list of tab positions" -args=( - "(--all)-a[$all]" - "(--tabs)-t[$tabs]:tablist" - "*:file:_files" -) +tabs="[use comma separated list of tab positions]:list of tab positions" if _pick_variant gnu="Free Soft" unix --version; then - args+=( - "(-a)--all[$all]" - "--first-only[convert only leading sequences of whitespace]" - "(-t)--tabs=[$tabs]:tablist" - "(* -)--help[display help message and exit]" - "(* -)--version[output version information and exit]" + 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 "$args[@]" && ret=0 +# Most (un)expand variants, excluding BusyBox, allow e.g. -4 instead of -t4 +[[ $_cmd_variant[$service] == *busybox* ]] || +args+=( '!(-0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -t --tabs)-'{0..9} ) -return ret +_arguments -s -S "$args[@]" \ + "(--tabs --help)-t+${tabs}" \ + '*:file:_files' |