zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: xz compression for (GNU) tar
@ 2009-12-03  5:29 Clint Adams
  2009-12-05  6:03 ` [PATCH 1/2] Complete lzma tarballs, the extension used for the previous format of xz Ingmar Vanhassel
  0 siblings, 1 reply; 2+ messages in thread
From: Clint Adams @ 2009-12-03  5:29 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 1/2] Complete lzma tarballs, the extension used for the previous format of xz
  2009-12-03  5:29 PATCH: xz compression for (GNU) tar Clint Adams
@ 2009-12-05  6:03 ` Ingmar Vanhassel
  0 siblings, 0 replies; 2+ messages in thread
From: Ingmar Vanhassel @ 2009-12-05  6:03 UTC (permalink / raw)
  To: Zsh hackers list; +Cc: Ingmar Vanhassel

Complete .tbz & .txz files too.
---
 Completion/Unix/Type/_tar_archive |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Here's an add-on patch that adds completion for .lzma, which xz can unpack too.
It's the extension used by a previous, deprecated format. Add .tbz, .txz too while add it.

The second line seemed to be missing a dot before 'xz', I added that also.

diff --git a/Completion/Unix/Type/_tar_archive b/Completion/Unix/Type/_tar_archive
index a39e841..28df776 100644
--- a/Completion/Unix/Type/_tar_archive
+++ b/Completion/Unix/Type/_tar_archive
@@ -19,9 +19,9 @@ if [[ "$1" = *[urtx]* ]]; then
   elif [[ "$1" = *[Ijy]* ]]; then
     _files "$expl[@]" -g '*.(tar|TAR).bz2(-.)'
   elif [[ "$1" = *J* ]]; then
-    _files "$expl[@]" -g '*.(tar|TAR).xz(-.)'
+    _files "$expl[@]" -g '*.(tar|TAR).(lzma|xz)(-.)'
   elif [[ "$_cmd_variant[$service]" == gnu ]]; then
-    _files "$expl[@]" -g '*.((tar|TAR)(.gz|.GZ|.Z|.bz2|xz|)|tgz)(-.)'
+    _files "$expl[@]" -g '*.((tar|TAR)(.gz|.GZ|.Z|.bz2|.lzma|.xz|)|(tbz|tgz|txz))(-.)'
   else
     _files "$expl[@]" -g '*.(tar|TAR)(-.)'
   fi
-- 
1.6.6.rc1.244.g34c92


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-12-05  6:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-03  5:29 PATCH: xz compression for (GNU) tar Clint Adams
2009-12-05  6:03 ` [PATCH 1/2] Complete lzma tarballs, the extension used for the previous format of xz Ingmar Vanhassel

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).