about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2017-07-15 14:55:41 +0200
committerOliver Kiddle <opk@zsh.org>2017-07-15 14:55:41 +0200
commit9e7315ab895f9a9f30518f49912ecd850ecabf70 (patch)
tree64a3dbe327433932472ce0e740c727f372f0ef13
parent8eaacb35419171b40e121c61323a5113e5f1977d (diff)
downloadzsh-9e7315ab895f9a9f30518f49912ecd850ecabf70.tar.gz
zsh-9e7315ab895f9a9f30518f49912ecd850ecabf70.tar.xz
zsh-9e7315ab895f9a9f30518f49912ecd850ecabf70.zip
41432: use option grouping in xz completion
-rw-r--r--Completion/Unix/Command/_xz81
1 files changed, 41 insertions, 40 deletions
diff --git a/Completion/Unix/Command/_xz b/Completion/Unix/Command/_xz
index 01e56022b..333557e66 100644
--- a/Completion/Unix/Command/_xz
+++ b/Completion/Unix/Command/_xz
@@ -2,7 +2,6 @@
 
 local decompress files expl state line curcontext="$curcontext" ret=1
 typeset -A opt_args
-local decomp="(-z --compress --decompress -d --test -t --list -l --single-stream --no-sparse)"
 
 files=( '(--files --files0)*:files:->files' )
 case "$service" in
@@ -14,46 +13,48 @@ case "$service" in
   ;&
   xz) decompress=no;&
   unxz) _arguments -C -s -S "$files[@]" \
+    '--robot[use machine-parsable messages]' \
+    + 'common' \
+    '(I -k --keep)'{-k,--keep}"[keep (don't delete) input files]" \
+    '(I -f --force)'{-f,--force}'[force overwrite]' \
+    '(I -c --stdout)'{-c,--stdout}'[write on standard output]' \
+    '(I)*'{-q,--quiet}'[suppress all warnings]' \
+    '(I)*'{-v,--verbose}'[verbose mode]' \
+    '(I * --files --files0)--files=-[read list of files to process from file]::file:_files' \
+    '(I * --files --files0)--files0=-[read null terminated list of files to process from file]::file:_files' \
+    '(I -F --format)'{-F,--format}'=[specify file format]:format:(auto xz lzma raw)' \
+    '(I -T --threads)'{-T+,--threads=}'[use specified number of threads]:threads [1]' \
+    '(I -M --memlimit --memory)'{-M+,--memlimit=,--memory=}'[set memory usage limit]:memory usage' \
+    '(I)--no-adjust[give error if settings exceed memory limit]' \
+    '(I -Q --no-warn)'{-Q,--no-warn}'[make warnings not affect exit status]' \
+    + 'comp' \
+    "(I decomp)"{-z,--compress}'[compress]' \
+    '(I decomp -e --extreme)'{-e,--extreme}'[try to improve compression ratio by using more CPU time]' \
+    '(I decomp -S --suffix)'{-S+,--suffix=}'[use specified suffix for compressed files]:suffix [.xz]' \
+    '(I decomp -C --check)'{-C,--check}'=[integrity check type]:check type:(none crc32 crc64 sha256)' \
+    '(I decomp)--block-size=[start a new .xz block after specified bytes of input]:size' \
+    '(I decomp)--block-list=[start a new .xz block after specified intervals of uncompressed data]:size' \
+    '(I decomp)--flush-timeout=[specify maximum time between flushing of output]:time (ms) [0]' \
+    '(I decomp)--memlimit-compress=[set memory usage limit for compression]:memory usage' \
+    + 'decomp' \
+    '(I comp level filters)'{-d,--decompress}'[decompress]' \
+    '(I comp level filters)'{-t,--test}'[test compressed file integrity]' \
+    '(I comp level filters)'{-l,--list}'[list information about .xz files]' \
+    "(I comp level filters)--ignore-check[don't verify integrity when decompressing]" \
+    '(I comp level filters)--single-stream[decompress only the first stream]' \
+    "(I comp level filters)--no-sparse[don't create sparse files when decompressing]" \
+    '(I comp level filters)--memlimit-decompress=[set memory usage limit for decompression]:memory usage' \
+    + '(I)' \
+    '(* comp decomp level filters common)--info-memory[display amount of RAM and memory usage limits]' \
     '(- *)'{-h,--help}'[display help message]' \
     '(- *)'{-H,--long-help}'[display the long help (lists also the advanced options)]' \
-    '(-d --decompress --compress -z --test -t --list -l)'{-d,--decompress}'[decompress]' \
-    "${decomp}"{-z,--compress}'[compress]' \
-    '(-k --keep)'{-k,--keep}"[keep (don't delete) input files]" \
-    '(-f --force)'{-f,--force}'[force overwrite]' \
-    '(-t --test --decompress -d --compress -z --list -l)'{-t,--test}'[test compressed file integrity]' \
-    '(-t --test --decompress -d --compress -z --list -l)'{-l,--list}'[list information about .xz files]' \
-    '(-c --stdout)'{-c,--stdout}'[write on standard output]' \
-    \*{-q,--quiet}'[suppress all warnings]' \
-    \*{-v,--verbose}'[verbose mode]' \
-    '(- *)'{-V,--version}'[display version number]' \
-    '(-e --extreme)'{-e,--extreme}'[try to improve compression ratio by using more CPU time]' \
-    '(-1 -2 -3 -4 -5 -6 -7 -8 -9 --fast       )--best' \
-    '(-1 -2 -3 -4 -5 -6 -7 -8 -9        --best)--fast' \
-    '(   -2 -3 -4 -5 -6 -7 -8 -9 --fast --best)-1' \
-    '(-1    -3 -4 -5 -6 -7 -8 -9 --fast --best)-2' \
-    '(-1 -2    -4 -5 -6 -7 -8 -9 --fast --best)-3' \
-    '(-1 -2 -3    -5 -6 -7 -8 -9 --fast --best)-4' \
-    '(-1 -2 -3 -4    -6 -7 -8 -9 --fast --best)-5' \
-    '(-1 -2 -3 -4 -5	-7 -8 -9 --fast --best)-6' \
-    '(-1 -2 -3 -4 -5 -6    -8 -9 --fast --best)-7' \
-    '(-1 -2 -3 -4 -5 -6 -7    -9 --fast --best)-8' \
-    '(-1 -2 -3 -4 -5 -6 -7 -8	 --fast --best)-9' \
-    "${decomp}--single-stream[decompress only the first stream]" \
-    "${decomp}--no-sparse[do not create sparse files when decompressing]" \
-    '(* --files --files0)--files=-[read list of files to process from file]::file:_files' \
-    '(* --files --files0)--files0=-[read null terminated list of files to process from file]::file:_files' \
-    '(-F --format)'{-F,--format}'=[specify file format]:format:(auto xz lzma raw)' \
-    '(-C --check)'{-C,--check}'=[integrity check type]:check type:(none crc32 crc64 sha256)' \
-    '--memlimit-compress=[set memory usage limit for compression]:memory usage' \
-    '--memlimit-decompress=[set memory usage limit for decompression]:memory usage' \
-    '(-M --memlimit --memory)'{-M+,--memlimit=,--memory=}'[set memory usage limit]:memory usage' \
-    '--no-adjust[give error if settings exceed memory limit]' \
-    '(-Q --no-warn)'{-Q,--no-warn}'[make warnings not affect exit status]' \
-    '--robot[use machine-parsable messages]' \
-    --{x86,powerpc,ia64,arm,armthumb,sparc}=-'[add a branch/call/jump filter]::option:->bcj-options' \
-    --lzma{1,2}=-'[add lzma filter]::option:->lzma-options' \
-    '--delta=-[add delta filter]::option:->delta-options' \
-    '(- *)--info-memory[display amount of RAM and memory usage limits]' && ret=0
+    '(* comp decomp level filters common)'{-V,--version}'[display version number]' \
+    + '(level)' \
+    '(I filters decomp)-'{-best,-fast,1,2,3,4,5,6,7,8,9} \
+    + filters \
+    '(I level decomp --extreme)'--{x86,powerpc,ia64,arm,armthumb,sparc}=-'[add a branch/call/jump filter]::option:->bcj-options' \
+    '(I level decomp --extreme)'--lzma{1,2}=-'[add lzma filter]::option:->lzma-options' \
+    '(I level decomp --extreme)--delta=-[add delta filter]::option:->delta-options' && ret=0
   ;;
 esac
 
@@ -71,7 +72,7 @@ case $state in
   ;;
   lzma-options)
     _values -s , options 'preset:preset' 'dict:size' 'lc:context bits' \
-      'lp:position bits' 'mf:matchfinder:(hc3 hc4 bt2 bt3 bt4)' \
+      'lp:position bits' 'pb:position bites' 'mf:matchfinder:(hc3 hc4 bt2 bt3 bt4)' \
       'mode:mode:(fast normal)' 'nice:length' 'depth:depth' && ret=0
   ;;
   bcj-options)