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

_tar_archive completion with uncompressed archives && GNU tar



Hello workers!

I experienced a problem with the completion of uncompressed tar
archives:

[snip]
zsh% autoload compinit && compinit
zsh% touch test.tar{,.gz,.bz2}
zsh% tar tvf test.tar.<TAB>
test.tar.bz2  test.tar.gz
[snap]

As you can see it doesn't complete 'test.tar'.
The _tar_archive function checks for $_cmd_variant to figure out if
the system uses the GNU version of tar and selects all compressed
archive files it finds, because GNU tar does some autosensing based on
the filename extension.
Anyway, I think that '.tar' files should be added as well.
This patch adds this behaviour:

--- _tar_archive.orig   2006-08-04 12:49:10.000000000 +0200
+++ _tar_archive        2006-08-04 12:47:48.000000000 +0200
@@ -19,7 +19,7 @@
   elif [[ "$1" = *[Ijy]* ]]; then
     _files "$expl[@]" -g '*.(tar|TAR).bz2(-.)'
   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|)|tgz)(-.)'
   else
     _files "$expl[@]" -g '*.(tar|TAR)(-.)'
   fi


Regards, Frank



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