[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-34-g0ae464e

Ville Skyttä ville.skytta at iki.fi
Sun Mar 20 16:25:02 UTC 2011


The following commit has been merged in the master branch:
commit 0ae464e5802855c9049d128a37e0de91b564c8b6
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sun Mar 20 18:22:21 2011 +0200

    Improve tar *[cr]*f completions (Debian: #618734).

diff --git a/completions/tar b/completions/tar
index 02e2dec..1dd1031 100644
--- a/completions/tar
+++ b/completions/tar
@@ -13,13 +13,25 @@ _tar()
         return 0
     fi
 
+    local tars='@(@(tar|gem|spkg)?(.@(Z|[gx]z|bz?(2)|lzma))|t@([glx]z|bz?(2)))'
+
     case ${words[1]} in
-        ?(-)[cr]*f)
-            _filedir
+        --*)
+            ;;
+        ?(-)*[cr]*f)
+            ext='@(tar|gem|spkg)'
+            case ${words[1]} in
+                *a*)    ext="$tars"         ;;
+                *z*)    ext='t?(ar.)gz'     ;;
+                *Z*)    ext='tar.Z'         ;;
+                *[jy]*) ext='t?(ar.)bz?(2)' ;;
+                *J*)    ext='t?(ar.)xz'     ;;
+            esac
+            _filedir $ext
             return 0
             ;;
         +([^IZzJjy])f)
-            ext='@(@(tar|gem|spkg)?(.@(Z|[gx]z|bz?(2)|lzma))|t@([glx]z|bz?(2)))'
+            ext="$tars"
             regex='\(\(tar\|gem\|spkg\)\(\.\(Z\|[gx]z\|bz2\?\|lzma\)\)\?\|t\([glx]z\|bz2\?\)\)'
             ;;
         *[Zz]*f)

-- 
bash-completion



More information about the Bash-completion-commits mailing list