about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Completion/User/.distfiles2
-rw-r--r--Completion/User/_bunzip23
-rw-r--r--Completion/User/_bzip258
4 files changed, 60 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index febeb6358..2144794d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2000-05-01  Oliver Kiddle  <opk@zsh.org>
 
+	* 11041: Completion/User/.distfiles, Completion/User/_bzip2:
+	Use of _arguments for bzip2 completion
+
 	* 11037: Etc/MACHINES, Etc/NEWS, Etc/completion-style-guide,
 	Etc/zsh-development-guide: spelling corrections
 
diff --git a/Completion/User/.distfiles b/Completion/User/.distfiles
index c3ad50915..471d3634c 100644
--- a/Completion/User/.distfiles
+++ b/Completion/User/.distfiles
@@ -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
diff --git a/Completion/User/_bunzip2 b/Completion/User/_bunzip2
deleted file mode 100644
index f544c8c27..000000000
--- a/Completion/User/_bunzip2
+++ /dev/null
@@ -1,3 +0,0 @@
-#compdef bunzip2 bzcat
-
-_files -g '*.bz2'
diff --git a/Completion/User/_bzip2 b/Completion/User/_bzip2
index faf9f2501..545aa5fcc 100644
--- a/Completion/User/_bzip2
+++ b/Completion/User/_bzip2
@@ -1,3 +1,57 @@
-#compdef bzip2
+#compdef bzip2 bzcat bunzip2 bzip2recover
 
-_files -g '*~*.bz2'
+local decompress expl state line
+typeset -A opt_args
+
+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