summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2000-05-05 10:08:25 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2000-05-05 10:08:25 +0000
commit93fb9aaec51f597a9a19b06764f005952e447e54 (patch)
treeb8fc3a394c943f8dcb77b7f8f12c3e80aedd79f7 /Completion
parent27f895df41af61a8ba678c390a5ef405109e8187 (diff)
downloadzsh-93fb9aaec51f597a9a19b06764f005952e447e54.tar.gz
zsh-93fb9aaec51f597a9a19b06764f005952e447e54.tar.xz
zsh-93fb9aaec51f597a9a19b06764f005952e447e54.zip
Use one function for compression/decompression programs and new lzop completion
Diffstat (limited to 'Completion')
-rw-r--r--Completion/User/.distfiles4
-rw-r--r--Completion/User/_bzip26
-rw-r--r--Completion/User/_compress46
-rw-r--r--Completion/User/_lzop102
-rw-r--r--Completion/User/_pack18
-rw-r--r--Completion/User/_uncompress3
-rw-r--r--Completion/User/_unpack6
-rw-r--r--Completion/User/_zcat3
8 files changed, 166 insertions, 22 deletions
diff --git a/Completion/User/.distfiles b/Completion/User/.distfiles
index 471d3634c..6d5f21873 100644
--- a/Completion/User/.distfiles
+++ b/Completion/User/.distfiles
@@ -4,13 +4,13 @@ DISTFILES_SRC='
     _configure _cvs _dd _diff _diff_options _dir_list _dirs
     _domains _dvi _enscript
     _find _finger _fakeroot _flex _gcc _gdb  _getconf _gprof _groups
-    _gs _gv _gzip _hosts _imagemagick _ispell _joe _killall _lp _lynx
+    _gs _gv _gzip _hosts _imagemagick _ispell _joe _killall _lp _lynx _lzop
     _mailboxes _make _man _mh _mount _mutt _my_accounts _mysql_utils _nedit
     _netscape _nslookup _other_accounts _pack _patch _pbm _pdf _perl
     _perl_basepods _perl_builtin_funcs _perl_modules _perldoc
     _ports _prcs _printers _prompt _ps _pspdf _psutils _rcs _rlogin _sh _socket
     _ssh _strip _stty _su _sudo _tar _tar_archive _telnet _tex _texi
-    _tiff _tilde_files _uncompress _unpack _urls _use_lo _user_at_host
+    _tiff _tilde_files _urls _use_lo _user_at_host
     _users _users_on _webbrowser _wget _whereis _whois _xargs _yodl _yp
     _zcat _zdump
 '
diff --git a/Completion/User/_bzip2 b/Completion/User/_bzip2
index 545aa5fcc..f0fd23f90 100644
--- a/Completion/User/_bzip2
+++ b/Completion/User/_bzip2
@@ -23,8 +23,8 @@ case "${words[1]:t}" in
     '(-c)--stdout[write on standard output]' \
     '(--quiet)-q[suppress all warnings]' \
     '(-q)--quiet[suppress all warnings]' \
-    '(--verbose)*-v[verbose mode]' \
-    '(-v)*--verbose[verbose mode]' \
+    '*-v[verbose mode]' \
+    '*--verbose[verbose mode]' \
     '(--license)-L[display software license]' \
     '(-L)--license[display software license]' \
     '(--version)-V[display version number]' \
@@ -45,7 +45,7 @@ esac
 
 if [[ "$state" = files ]]; then
   (( $+opt_args[-z] || $+opt_args[--compress] )) && decompress=no
-  (( $+opt_args[-d] || $+opt_args[--decompress] || $+opt_args[-t] || \
+  (( $+opt_args[-d] || $+opt_args[--decompress] || $+opt_args[-t] ||
       $+opt_args[--test] )) && unset decompress
   if [[ -z "$decompress" ]] ; then
     _description files expl 'compressed file'
diff --git a/Completion/User/_compress b/Completion/User/_compress
index 860aeb5b0..288bb1645 100644
--- a/Completion/User/_compress
+++ b/Completion/User/_compress
@@ -1,3 +1,45 @@
-#defcomp compress
+#compdef compress uncompress
 
-_files -g '*~*.Z'
+local expl state line bits common_args1 common_args2 decompress
+typeset -A opt_args
+bits=( {9..16} )
+
+common_args1=( \
+  '-n[omit compressed file header from compressed file]' \
+  '-V[display current version and compile options]' \
+  '*:files:->files')
+common_args2=( \
+  '-c[write on standard output]' \
+  '(-F)-f[force overwrite]' \
+  '(-f)-F[force overwrite]' \
+  '(-v)-q[suppress display of compression statistics]' \
+  '(-q)-v[display compression statistics]' \
+  "${common_args1[@]}" )
+
+case "${words[1]:t}" in
+  compress)
+    _arguments -s \
+      "-b[specify maximum number of bits used to replace common substring]:bits:(${bits[*]})" \
+      '-C[produce output compatible with BSD 2.0]' \
+      '(-b -C)-d[decompress]' \
+      "${common_args2[@]}"
+  ;;
+  uncompress)
+    _arguments -s "${common_args2[@]}"
+    decompress=yes
+  ;;
+  zcat)
+    _arguments -s "${common_args1[@]}"
+    decompress=yes
+  ;;
+esac
+
+if [[ "$state" = files ]]; then
+  if [[ -z "$decompress" ]] || (( $+opt_args[-d] )); then
+    _description files expl 'file to compress'
+    _files "$expl[@]" -g '*~*.Z'
+  else
+    _description files expl 'compressed file'
+    _files "$expl[@]" -g '*.Z'
+  fi
+fi
diff --git a/Completion/User/_lzop b/Completion/User/_lzop
new file mode 100644
index 000000000..fb9bea153
--- /dev/null
+++ b/Completion/User/_lzop
@@ -0,0 +1,102 @@
+#compdef lzop
+
+local expl state line decompress disp
+typeset -A opt_args
+
+_arguments -C -s \
+  '(--to-stdout --stdout)-c[write on standard output]' \
+  '(-c --stdout)--to-stdout[write on standard output]' \
+  '(-c --to-stdout)--stdout[write on standard output]' \
+  '(--decompress --uncompress -x -extract)-d[decompress]' \
+  '(-d --uncompress -x -extract)--decompress[decompress]' \
+  '(-d --decompress -x -extract)--uncompress[decompress]' \
+  '(--extract -d --decompress --uncompress -n --name -p --path)-x[extract]' \
+  '(-x -d --decompress --uncompress -n --name -p --path)-x[extract]' \
+  '(--force)-f[force overwrite]' \
+  '(-f)--force[force overwrite]' \
+  '(--help -H)-h[display help message]' \
+  '(-h -H)--help[display help message]' \
+  '(-h --help)-H[display help message]' \
+  '(--list)-l[list compressed file contents]' \
+  '(-l)--list[list compressed file contents]' \
+  '(--license)-L[display software license]' \
+  '(-L)--license[display software license]' \
+  '(--no-name -N --name)-n[do not save or restore the original name and time stamp]' \
+  '(-n -N --name)--no-name[do not save or restore the original name and time stamp]' \
+  '(--name -n --no-name)-N[save or restore the original name and time stamp]' \
+  '(-N -n --no-name)--name[save or restore the original name and time stamp]' \
+  '--no-mode[do not restore original mode]' \
+  '--no-time[do not restore original time stamp]' \
+  '(--quiet --silent)-q[suppress all warnings]' \
+  '(-q --silent)--quiet[suppress all warnings]' \
+  '(-q --quiet)--silent[suppress all warnings]' \
+  '(--recursive)-r[operate recursively on directories]' \
+  '(-r)--recursive[operate recursively on directories]' \
+  '(--suffix)-S+[specify suffix for compressed files]:suffix:' \
+  '(-S)--suffix=[specify suffix for compressed files]:suffix:' \
+  '(--test)-t[test compressed file integrity]' \
+  '(-t)--test[test compressed file integrity]' \
+  '*-v[verbose mode]' \
+  '*--verbose[verbose mode]' \
+  '(--version)-V[display version number]' \
+  '(-V)--version[display version number]' \
+  '(       -1 -2 -3 -4 -5 -6 -7 -8 -9 --best)--fast' \
+  '(--fast    -2 -3 -4 -5 -6 -7 -8 -9 --best)-1' \
+  '(--fast -1    -3 -4 -5 -6 -7 -8 -9 --best)-2' \
+  '(--fast -1 -2    -4 -5 -6 -7 -8 -9 --best)-3' \
+  '(--fast -1 -2 -3    -5 -6 -7 -8 -9 --best)-4' \
+  '(--fast -1 -2 -3 -4    -6 -7 -8 -9 --best)-5' \
+  '(--fast -1 -2 -3 -4 -5    -7 -8 -9 --best)-6' \
+  '(--fast -1 -2 -3 -4 -5 -6    -8 -9 --best)-7' \
+  '(--fast -1 -2 -3 -4 -5 -6 -7    -9 --best)-8' \
+  '(--fast -1 -2 -3 -4 -5 -6 -7 -8    --best)-9' \
+  '(--fast -1 -2 -3 -4 -5 -6 -7 -8 -9       )--best' \
+  '--ls=[list each compressed file in a format similar to ls -ln]:ls flag:->flags' \
+  '--info[list internal header fields for each compressed file]' \
+  '(--sysinfo)-I[display information about the system]' \
+  '(-I)--sysinfo[display information about the system]' \
+  '(--outfile)-o[specify output file]:output file:_files' \
+  '(-o)--outfile=[specify output file]:output file:_files' \
+  '(--path)-p[write output files to specified directory]:directory:_files -/' \
+  '(-p)--path=[[write output files to specified directory]:directory:_files -/' \
+  '(--no-checksum)-F[do not store or verify a checksum]' \
+  '(-F)--no-checksum[do not store or verify a checksum]' \
+  "(--keep -U --unlink --delete)-k[keep (don't delete) input files]" \
+  "(-k -U --unlink --delete)--keep[keep (don't delete) input files]" \
+  '(--unlink --delete)-U[delete input files]' \
+  '(-U --delete)--unlink[delete input files]' \
+  '(-U --unlink)--delete[delete input files]' \
+  '--no-stdin[do not try to read stdin]' \
+  '--no-warn[suppress all warnings]' \
+  '--ignore-warn[suppress all warnings and never exit with status 2]' \
+  '--no-color[do not use an color escape sequences]' \
+  '--mono[assume a mono ANSI terminal]' \
+  '--color[assume a color ANSI terminal]' \
+  '--intro[display intro sequence]' \
+  '--filter=[preprocess data with a special multimedia filter]:number' \
+  '*:files:->files'
+
+case "$state" in
+  files)
+    if (( $+opt_args[-d] || $+opt_args[--decompress] ||
+	$+opt_args[--uncompress] || $+opt_args[-x] || $+opt_args[--extract] ||
+	$+opt_args[--test] || $+opt_args[-t] || $+opt_args[--list] ||
+	$+opt_args[-l] || $+opt_args[--ls] || $+opt_args[--info] )); then
+      _description files expl 'compressed file'
+      _files "$expl[@]" -g '*.[tl]zo'
+    else
+      _description files expl 'file to compress'
+      _files "$expl[@]" -g '*~*.[tl]zo'
+
+    fi
+  ;;
+  flags)
+    disp=( \
+      "F -- Append a \`*' for executable files" \
+      "G -- Inhibit display of group information" \
+      "Q -- Enclose file names in double quotes" )
+    disp=( ${disp[@]%[Z$PREFIX] -*} )
+    compset -P '[FGQ]*'
+    compadd -d disp - ${disp[@]% -*}
+  ;;
+esac
diff --git a/Completion/User/_pack b/Completion/User/_pack
index a15cfa709..5ec7a160c 100644
--- a/Completion/User/_pack
+++ b/Completion/User/_pack
@@ -1,6 +1,16 @@
-#compdef pack 
+#compdef pack pcat unpack
 
-local expl
+local expl state line
 
-_description expl 'file to compress'
-_files "$expl[@]" -g '*~*.z'
+case ${words[1]:t} in
+  pack)
+    _arguments -C \
+      '-f[force packing even for files which will not benefit]' \
+      '-[show statistics for files]' \
+      '*:file to compress:_files -g \*\~\*.z'
+  ;;
+  pcat|unpack)
+    _description files expl 'compressed file'
+    _files "$expl[@]" -g '*.z'
+  ;;
+esac
diff --git a/Completion/User/_uncompress b/Completion/User/_uncompress
deleted file mode 100644
index e25805d50..000000000
--- a/Completion/User/_uncompress
+++ /dev/null
@@ -1,3 +0,0 @@
-#defcomp uncompress zmore
-
-_files -g '*.Z'
diff --git a/Completion/User/_unpack b/Completion/User/_unpack
deleted file mode 100644
index fb8867560..000000000
--- a/Completion/User/_unpack
+++ /dev/null
@@ -1,6 +0,0 @@
-#compdef unpack pcat
-
-local expl
-
-_description expl 'compressed file'
-_files "$expl[@]" -g '*.z'
diff --git a/Completion/User/_zcat b/Completion/User/_zcat
index 378844511..78a848e36 100644
--- a/Completion/User/_zcat
+++ b/Completion/User/_zcat
@@ -15,6 +15,5 @@ if [[ -n "$_is_gnu[$words[1]]" ]]
 then
   _gzip "$@"
 else
-  _description files expl 'compressed file'
-  _files "$expl[@]" -g '*.Z'
+  _compress "$@"
 fi