zsh-workers
 help / color / mirror / code / Atom feed
From: Clint Adams <clint@zsh.org>
To: zsh-workers@zsh.org
Subject: PATCH: xz compression for (GNU) tar
Date: Thu, 3 Dec 2009 05:29:45 +0000	[thread overview]
Message-ID: <20091203052945.GA25221@scru.org> (raw)

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


             reply	other threads:[~2009-12-03  5:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-03  5:29 Clint Adams [this message]
2009-12-05  6:03 ` [PATCH 1/2] Complete lzma tarballs, the extension used for the previous format of xz Ingmar Vanhassel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091203052945.GA25221@scru.org \
    --to=clint@zsh.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).