Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: xz compression for (GNU) tar



I didn't bother with --lzma since it doesn't have a matching short option.
Also I wonder why that long series of elifs isn't a case statement.

Index: Completion/Unix/Command/_tar
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_tar,v
retrieving revision 1.8
diff -u -r1.8 _tar
--- Completion/Unix/Command/_tar	11 Jul 2008 19:12:24 -0000	1.8
+++ Completion/Unix/Command/_tar	3 Dec 2009 05:27:05 -0000
@@ -35,6 +35,8 @@
 
 (( $words[(I)--(un|)gzip] ))     && _tar_cmd="z$_tar_cmd"
 (( $words[(I)--(un|)compress] )) && _tar_cmd="Z$_tar_cmd"
+(( $words[(I)--bzip2] ))         && _tar_cmd="j$_tar_cmd"
+(( $words[(I)--xz] ))            && _tar_cmd="J$_tar_cmd"
 (( $words[(I)--list] ))          && _tar_cmd="t$_tar_cmd"
 (( $words[(I)--(extract|get)] )) && _tar_cmd="x$_tar_cmd"
 (( $words[(I)--create] ))        && _tar_cmd="c$_tar_cmd"
@@ -141,6 +143,8 @@
     largs=-tZf
   elif [[ $_tar_cmd = *I* ]]; then
     largs=-tIf
+  elif [[ $_tar_cmd = *J* ]]; then
+    largs=-tJf
   else
     # Some random compression program
     tmp="${words[(r)--use-comp*]}"
Index: Completion/Unix/Type/_tar_archive
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_tar_archive,v
retrieving revision 1.5
diff -u -r1.5 _tar_archive
--- Completion/Unix/Type/_tar_archive	4 Aug 2006 11:41:07 -0000	1.5
+++ Completion/Unix/Type/_tar_archive	3 Dec 2009 05:27:05 -0000
@@ -18,8 +18,10 @@
     _files "$expl[@]" -g '*.((tar|TAR).(gz|GZ|Z)|tgz)(-.)'
   elif [[ "$1" = *[Ijy]* ]]; then
     _files "$expl[@]" -g '*.(tar|TAR).bz2(-.)'
+  elif [[ "$1" = *J* ]]; then
+    _files "$expl[@]" -g '*.(tar|TAR).xz(-.)'
   elif [[ "$_cmd_variant[$service]" == gnu ]]; then
-    _files "$expl[@]" -g '*.((tar|TAR)(.gz|.GZ|.Z|.bz2|)|tgz)(-.)'
+    _files "$expl[@]" -g '*.((tar|TAR)(.gz|.GZ|.Z|.bz2|xz|)|tgz)(-.)'
   else
     _files "$expl[@]" -g '*.(tar|TAR)(-.)'
   fi



Messages sorted by: Reverse Date, Date, Thread, Author