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

Igor Murzov igor at gplsoft.org
Mon May 2 10:27:53 UTC 2011


The following commit has been merged in the master branch:
commit 503640588dff19cf8b3a3ce8646ee90ed7173bb0
Author: Igor Murzov <igor at gplsoft.org>
Date:   Fri Jan 28 06:25:50 2011 +0300

    Make slackpkg comlete several package names for all actions

diff --git a/completions/slackpkg b/completions/slackpkg
index f72d658..139e7ed 100644
--- a/completions/slackpkg
+++ b/completions/slackpkg
@@ -4,8 +4,8 @@ have slackpkg &&
 _slackpkg()
 {
     COMPREPLY=()
-    local cur prev
-    _get_comp_words_by_ref cur prev
+    local cur
+    _get_comp_words_by_ref cur
 
     # based on `grep '\-.*\=.*)' /usr/sbin/slackpkg | cut -f1 -d\)`
     if [[ "$cur" == -* ]]; then
@@ -35,7 +35,17 @@ _slackpkg()
     fi
     . "$config"
 
-    case $prev in
+    local action words
+    _get_comp_words_by_ref -n "=" words
+
+    for (( i=1; i<${#words[@]}; i++ )); do
+        if [[ "${words[i]}" != -* ]]; then
+            action="${words[i]}"
+            break
+        fi
+    done
+
+    case $action in
         generate-template|search|file-search)
             # argument required but no completions available
             return 0

-- 
bash-completion



More information about the Bash-completion-commits mailing list