[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-364-gd44aaed

Igor Murzov e-mail at date.by
Sun Jun 12 14:52:19 UTC 2011


The following commit has been merged in the master branch:
commit 9cb6a1cd70f7be770209fb78da6fd75d8a8712b0
Author: Igor Murzov <e-mail at date.by>
Date:   Sun Jun 12 18:07:30 2011 +0400

    slapt-src: Complete package versions for --build|--install options

diff --git a/completions/slapt b/completions/slapt
index beaaff0..28faf4c 100644
--- a/completions/slapt
+++ b/completions/slapt
@@ -89,7 +89,7 @@ have slapt-src &&
 _slapt_src()
 {
     local cur prev words cword
-    _init_completion || return
+    _init_completion -n : || return
 
     case "$prev" in
         --config|-c)
@@ -134,18 +134,15 @@ _slapt_src()
         return 0
     fi
 
-    local builddir=$( sed -ne "/^BUILDDIR=/{s/^BUILDDIR=//;p}" "$config" )
-    if [ ! -d "$builddir" ]; then
-        return 0
-    fi
-
-    local slck_data="${builddir}/slackbuilds_data"
-    if [ ! -r "$slck_data" ]; then
-        return 0
+    if [[ "$cur" == *:* ]]; then
+        local name=${cur%:*}
+        local version=${cur##*:}
+        COMPREPLY=( $( slapt-src --config $config --search "^$name" 2> \
+            /dev/null | sed -ne "/^$cur/{s/^$name:\([^ ]*\) .*$/\1/;p}" ) )
+    else
+        COMPREPLY=( $( slapt-src --config $config --search "^$cur" 2>/dev/null \
+            | sed -ne "/^$cur/{s/ .*$//;p}" ) )
     fi
-
-    COMPREPLY=( $( sed -ne \
-        "/^SLACKBUILD NAME: $cur/{s/^SLACKBUILD NAME: //;p}" "$slck_data" ) )
 } && complete -F _slapt_src slapt-src
 
 # Local variables:

-- 
bash-completion



More information about the Bash-completion-commits mailing list