mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-11-19 21:44:11 +01:00
60 lines
2.3 KiB
Plaintext
60 lines
2.3 KiB
Plaintext
#compdef bzip2 bunzip2 bzcat=bunzip2 bzip2recover -redirect-,<,bunzip2=bunzip2 -redirect-,>,bzip2=bunzip2 -redirect-,<,bzip2=bzip2
|
|
|
|
local decompress expl state line curcontext="$curcontext" ret=1
|
|
typeset -A opt_args
|
|
|
|
case "$service" in
|
|
bzip2recover) [[ $CURRENT = 2 ]] && state=files;;
|
|
bzip2) decompress=no;&
|
|
bunzip2) _arguments -C -s -S \
|
|
'(--help)-h[display help message]' \
|
|
'(-h)--help[display help message]' \
|
|
'(--decompress --compress -z --test -t)-d[decompress]' \
|
|
'(-d --compress -z --test -t)--decompress[decompress]' \
|
|
'(--compress --decompress -d --test -t)-z[compress]' \
|
|
'(-z --decompress -d --test -t)--compress[compress]' \
|
|
"(--keep)-k[keep (don't delete) input files]" \
|
|
"(-k)--keep[keep (don't delete) input files]" \
|
|
'(--force)-f[force overwrite]' \
|
|
'(-f)--force[force overwrite]' \
|
|
'(--test --decompress -d --compress -z )-t[test compressed file integrity]' \
|
|
'(-t --decompress -d --compress -z )--test[test compressed file integrity]' \
|
|
'(--stdout)-c[write on standard output]' \
|
|
'(-c)--stdout[write on standard output]' \
|
|
'(--quiet)-q[suppress all warnings]' \
|
|
'(-q)--quiet[suppress all warnings]' \
|
|
'*-v[verbose mode]' \
|
|
'*--verbose[verbose mode]' \
|
|
'(--license)-L[display software license]' \
|
|
'(-L)--license[display software license]' \
|
|
'(--version)-V[display version number]' \
|
|
'(-V)--version[display version number]' \
|
|
'(--small)-s[use less memory (at most 2500k)]' \
|
|
'( -2 -3 -4 -5 -6 -7 -8 -9)-1' \
|
|
'(-1 -3 -4 -5 -6 -7 -8 -9)-2' \
|
|
'(-1 -2 -4 -5 -6 -7 -8 -9)-3' \
|
|
'(-1 -2 -3 -5 -6 -7 -8 -9)-4' \
|
|
'(-1 -2 -3 -4 -6 -7 -8 -9)-5' \
|
|
'(-1 -2 -3 -4 -5 -7 -8 -9)-6' \
|
|
'(-1 -2 -3 -4 -5 -6 -8 -9)-7' \
|
|
'(-1 -2 -3 -4 -5 -6 -7 -9)-8' \
|
|
'(-1 -2 -3 -4 -5 -6 -7 -8 )-9' \
|
|
'*:files:->files' && ret=0
|
|
;;
|
|
esac
|
|
|
|
if [[ "$state" = files ]]; then
|
|
(( $+opt_args[-z] || $+opt_args[--compress] )) && decompress=no
|
|
(( $+opt_args[-d] || $+opt_args[--decompress] || $+opt_args[-t] ||
|
|
$+opt_args[--test] )) && unset decompress
|
|
if [[ -z "$decompress" ]]; then
|
|
_description files expl 'compressed file'
|
|
_files "$expl[@]" -g '*.(bz2|tbz|tbz2)(-.)' && return
|
|
else
|
|
_description files expl 'file to compress'
|
|
_files "$expl[@]" -g '^*.(bz2|tbz|tbz2)(-.)' && return
|
|
fi
|
|
fi
|
|
|
|
return ret
|