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

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


The following commit has been merged in the master branch:
commit e5374483a1041d98c58f9d8026c974bb708c5d84
Author: Igor Murzov <igor at gplsoft.org>
Date:   Sun Dec 26 03:39:27 2010 +0300

    Clean up sbopkg completion
    
    Signed-off-by: Sergey V <sftp.mtuci at gmail.com>

diff --git a/completions/slackware b/completions/slackware
index ca45b4a..ae3c606 100644
--- a/completions/slackware
+++ b/completions/slackware
@@ -157,52 +157,47 @@ _sbopkg()
     local cur prev
     _get_comp_words_by_ref cur prev
 
-    if [[ "$cur" == --* ]]; then
-	COMPREPLY=( $( compgen -W '--help' -- "$cur" ) )
-	return 0
-    fi
-
     if [[ "$cur" == -* ]]; then
-	COMPREPLY=( $( compgen -W '-b -c -d -e -f -g -h -i -k -l \
-				   -o -P -p -q -R -r -s -u -V -v' -- "$cur" ) )
-	return 0
+        COMPREPLY=( $( compgen -W '-b -c -d -e -f -g -h -i -k -l \
+                      -o -P -p -q -R -r -s -u -V -v' -- "$cur" ) )
+        return 0
     fi
 
-    local config=/etc/sbopkg/sbopkg.conf
+    local config="/etc/sbopkg/sbopkg.conf"
     for (( i=${#words[@]}-1; i>0; i-- )); do
-	if [[ ${words[i]} == '-f' ]]; then
-	    config="${words[i+1]}"
-	fi
+        if [[ ${words[i]} == '-f' ]]; then
+            config="${words[i+1]}"
+        fi
     done
-    
-    if [ -e $config ]; then
-	. $config
+
+    if [ -e "$config" ]; then
+        . $config
     fi
 
     if [ ! -r "$config" ]; then
-	return 0
+        return 0
     fi
-       
+
     for (( i=${#words[@]}-1; i>0; i-- )); do
-	if [[ ${words[i]} == '-V' ]]; then
-	    REPO_NAME=`echo ${words[i+1]} | cut -f1 -d/`
-	    REPO_BRANCH=`echo ${words[i+1]} | cut -f2 -d/`
-	fi
+        if [[ ${words[i]} == '-V' ]]; then
+            REPO_NAME=`echo ${words[i+1]} | cut -f1 -d/`
+            REPO_BRANCH=`echo ${words[i+1]} | cut -f2 -d/`
+        fi
     done
 
     case $prev in
-	-f)
-	    _filedir
-	    return 0
-	    ;;
-	-s|-g|-V)
-	    return 0
-	    ;;
-	-i|-b)
-	    COMPREPLY=( $( grep "^SLACKBUILD NAME: $cur" \
-		$REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT | cut -f3- -d\  ) )
-	    return 0
-	    ;;
+        -f)
+            _filedir
+            return 0
+            ;;
+        -s|-g|-V)
+            return 0
+            ;;
+        -i|-b)
+            COMPREPLY=( $( grep "^SLACKBUILD NAME: $cur" \
+            $REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT | cut -f3- -d\  ) )
+            return 0
+            ;;
     esac
 
 } && complete -F _sbopkg sbopkg -o plusdirs

-- 
bash-completion



More information about the Bash-completion-commits mailing list