diff options
Diffstat (limited to 'Completion/Unix/Command/_head')
-rw-r--r-- | Completion/Unix/Command/_head | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/Completion/Unix/Command/_head b/Completion/Unix/Command/_head index f25c97c83..8877600f6 100644 --- a/Completion/Unix/Command/_head +++ b/Completion/Unix/Command/_head @@ -9,6 +9,7 @@ if _pick_variant gnu=GNU unix --version; then '(-n --lines -c --bytes)'{-n+,--lines=}'[print the first (or with -, all but the last) specified lines]:number of lines:->number' '(-q --quiet --silent -v --verbose)'{-q,--quiet,--silent}'[never print headers giving file names]' '(-q --quiet --silent -v --verbose)'{-v,--verbose}'[always print headers giving file names]' + '(-z --zero-terminated)'{-z,--zero-terminated}'[line delimiter is NUL, not newline]' '(- *)--help[display help and exit]' '(- *)--version[output version information and exit]' ) @@ -32,20 +33,14 @@ _arguments -C -s -S $opts : $args '*:file:_files' && return 0 case $state in (number) - local mlt sign digit - mlt='multiplier:multiplier:((b\:512 K\:1024 KB\:1000 M\:1024\^2' - mlt+=' MB\:1000\^2 G\:1024\^3 GB\:1000\^3 T\:1024\^4 TB\:1000\^4))' - sign='sign:sign:((-\:"print all but the last specified bytes/lines"' - sign+=' +\:"print the first specified bytes/lines (default)"))' - digit='digits:digit:(0 1 2 3 4 5 6 7 8 9)' - if compset -P '(-|+|)[0-9]##'; then - _alternative $mlt $digit && ret=0 - elif [[ -z $PREFIX ]]; then - _alternative $sign $digit && ret=0 - elif compset -P '(+|-)'; then - _alternative $digit && ret=0 - fi - ;; + local alts + [[ -z $PREFIX ]] && alts=( + 'sign:sign:((-\:"print all but the last specified bytes/lines" +\:"print the first specified bytes/lines (default)"))' + ) + compset -P '+' + alts+=( 'numbers: :_numbers -N $state_descr b\:512 K\:1024 KB\:1000 M\:1024\^2 MB\:1000\^2 G\:1024\^3 GB\:1000\^3 T\:1024\^4 TB\:1000\^4' ) + _alternative $alts && ret=0 + ;; esac return ret |