Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: use of _arguments for _bzip2
- X-seq: zsh-workers 11041
- From: Oliver Kiddle <opk@xxxxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxxxxxxxxx>
- Subject: PATCH: use of _arguments for _bzip2
- Date: Mon, 01 May 2000 16:22:44 +0100
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
I've updated _bzip2 to use _arguments. It is largely a rip-off of
Tanaka's new gzip completion. Note that _bunzip2 is removed.
Oliver
Index: .distfiles
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/.distfiles,v
retrieving revision 1.6
diff -u -r1.6 .distfiles
--- .distfiles 2000/04/30 21:04:54 1.6
+++ .distfiles 2000/05/01 15:20:14
@@ -1,6 +1,6 @@
DISTFILES_SRC='
.distfiles
- _a2ps _archie _bison _bunzip2 _bzip2 _chown _compress
+ _a2ps _archie _bison _bzip2 _chown _compress
_configure _cvs _dd _diff _diff_options _dir_list _dirs
_domains _dvi _enscript
_find _finger _fakeroot _flex _gcc _gdb _getconf _gprof _groups
Index: _bzip2
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_bzip2,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 _bzip2
--- _bzip2 1999/12/01 15:29:43 1.1.1.3
+++ _bzip2 2000/05/01 15:20:14
@@ -1,6 +1,57 @@
-#compdef bzip2
+#compdef bzip2 bzcat bunzip2 bzip2recover
-local expl
+local decompress expl state line
+typeset -A opt_args
-_description files expl 'file to compress'
-_files "$expl[@]" -g '*~*.bz2'
+case "${words[1]:t}" in
+ bzip2recover) [[ $CURRENT = 2 ]] && state=files;;
+ bzip2) decompress=no;&
+ bunzip2|bzcat) _arguments -C -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]' \
+ '(--verbose)*-v[verbose mode]' \
+ '(-v)*--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'
+ ;;
+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'
+ else
+ _description files expl 'file to compress'
+ _files "$expl[@]" -g '*~*.bz2'
+ fi
+fi
Messages sorted by:
Reverse Date,
Date,
Thread,
Author