[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-235-g26ae770

Igor Murzov igor at gplsoft.org
Mon May 2 10:26:57 UTC 2011


The following commit has been merged in the master branch:
commit 4ebdc48bc371a5bbd6828e766094771f9feb5cfc
Author: Igor Murzov <igor at gplsoft.org>
Date:   Mon May 24 22:58:52 2010 +0400

    Add option completion for installpkg

diff --git a/contrib/pkgtools b/contrib/pkgtools
index a0aa598..a25c350 100644
--- a/contrib/pkgtools
+++ b/contrib/pkgtools
@@ -69,7 +69,39 @@ _upgradepkg()
     COMPREPLY=( $(compgen -f -X "!*.t[bglx]z" -- "$cur") )
 } && complete -F _upgradepkg -o plusdirs upgradepkg
 
-complete -o plusdirs -f -X '!*.t[bglx]z' installpkg explodepkg
+have installpkg && [ -f /etc/slackware-version ] &&
+_installpkg()
+{
+    COMPREPLY=()
+    local cur=`_get_cword`
+    if [[ "$cur" == -* ]]; then
+        COMPREPLY=( $( compgen -W '--warn --md5sum --root --infobox \
+            --menu --ask --priority --tagfile' -- "$cur") )
+        return 0
+    fi
+
+    local prev=`_get_pword`
+
+    case $prev in
+        --root)
+            _filedir -d
+            return 0
+            ;;
+        --priority)
+            COMPREPLY=( $( compgen -W 'ADD REC OPT SKP' -- "$cur" ) )
+            return 0
+            ;;
+        --tagfile)
+            _filedir
+            return 0
+            ;;
+    esac
+
+    COMPREPLY=( $(compgen -f -X "!*.t[bglx]z" -- "$cur") \
+                $(compgen -d -- "$cur") )
+} && complete -F _installpkg -o filenames installpkg
+
+complete -o plusdirs -f -X '!*.t[bglx]z' explodepkg
 
 # Local variables:
 # mode: shell-script

-- 
bash-completion



More information about the Bash-completion-commits mailing list