about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorPaul Ackersviller <packersv@users.sourceforge.net>2007-10-23 15:33:52 +0000
committerPaul Ackersviller <packersv@users.sourceforge.net>2007-10-23 15:33:52 +0000
commitee5a46dbe139312a1a63553c40df0c354f817a58 (patch)
treeb5ebbda4d0b7c8426adce535b28424cebea97bad /Completion
parent170cd69f50485faa24686a5e47477f3cead77d07 (diff)
downloadzsh-ee5a46dbe139312a1a63553c40df0c354f817a58.tar.gz
zsh-ee5a46dbe139312a1a63553c40df0c354f817a58.tar.xz
zsh-ee5a46dbe139312a1a63553c40df0c354f817a58.zip
Merge of 22511 and 22584.
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Unix/Type/_tar_archive28
1 files changed, 28 insertions, 0 deletions
diff --git a/Completion/Unix/Type/_tar_archive b/Completion/Unix/Type/_tar_archive
new file mode 100644
index 000000000..1ac7cd0bf
--- /dev/null
+++ b/Completion/Unix/Type/_tar_archive
@@ -0,0 +1,28 @@
+#autoload
+
+# This is used to generate filenames usable as a tar archive. This may
+# get one argument, a collection of tar option characters that may be
+# used to find out what kind of filename is needed. If no argument is
+# given but the parameter `_tar_cmd' is set, that is used.
+# If your version of `tar' supports this you may want to complete
+# things like `host:file' or `user@host:file' here.
+
+local expl
+
+[[ $# -eq 0 && $+_tar_cmd -ne 0 ]] && set "$_tar_cmd"
+
+_description files expl 'archive file'
+
+if [[ "$1" = *[urtx]* ]]; then
+  if [[ "$1" = *[zZ]* ]]; then
+    _files "$expl[@]" -g '*.((tar|TAR).(gz|GZ|Z)|tgz)(-.)'
+  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)(-.)'
+  else
+    _files "$expl[@]" -g '*.(tar|TAR)(-.)'
+  fi
+else
+  _files "$expl[@]"
+fi