[Bash-completion-commits] [SCM] bash-completion branch, master, updated. c8fb5f2eb1df48fd98e370967829d3e65d7c9f25

Ville Skyttä ville.skytta at iki.fi
Sat Sep 4 21:12:55 UTC 2010


The following commit has been merged in the master branch:
commit c8fb5f2eb1df48fd98e370967829d3e65d7c9f25
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sun Sep 5 00:12:24 2010 +0300

    Simplify rpm query mode detection expressions.

diff --git a/contrib/rpm b/contrib/rpm
index ceb4cfc..1be2ff5 100644
--- a/contrib/rpm
+++ b/contrib/rpm
@@ -185,7 +185,7 @@ _rpm()
                 --queryformat --rcfile --requires --scripts --suggests
                 --triggeredby --triggers --whatprovides --whatrequires --xml"
 
-            if [ "${COMP_LINE#* -@(*([^ -])f|-file )}" != "$COMP_LINE" ]; then
+            if [[ $COMP_LINE == *\ -@(*([^ -])f|-file )* ]]; then
                 # -qf completion
                 if [[ "$cur" == -* ]]; then
                     COMPREPLY=( $( compgen -W "$opts --dbpath --fscontext \
@@ -193,10 +193,10 @@ _rpm()
                 else
                     _filedir
                 fi
-            elif [ "${COMP_LINE#* -@(*([^ -])g|-group )}" != "$COMP_LINE" ]; then
+            elif [[ $COMP_LINE == *\ -@(*([^ -])g|-group )* ]]; then
                 # -qg completion
                 _rpm_groups
-            elif [ "${COMP_LINE#* -@(*([^ -])p|-package )}" != "$COMP_LINE" ]; then
+            elif [[ $COMP_LINE == *\ -@(*([^ -])p|-package )* ]]; then
                 # -qp; uninstalled package completion
                 if [[ "$cur" == -* ]]; then
                     COMPREPLY=( $( compgen -W "$opts --ftpport --ftpproxy \
@@ -209,7 +209,7 @@ _rpm()
                 if [[ "$cur" == -* ]]; then
                     COMPREPLY=( $( compgen -W "$opts --dbpath --fscontext \
                         --last --root --state" -- "$cur" ) )
-                elif [ "${COMP_LINE#* -@(*([^ -])a|-all )}" == "$COMP_LINE" ]; then
+                elif [[ $COMP_LINE != *\ -@(*([^ -])a|-all )* ]]; then
                     _rpm_installed_packages "$nodig" "$nosig"
                 fi
             fi
@@ -229,11 +229,11 @@ _rpm()
                     --nofiles --noscripts --nomd5 --querytags --specfile \
                     --whatrequires --whatprovides" -- "$cur" ) )
             # check whether we're doing file completion
-            elif [ "${COMP_LINE#* -@(*([^ -])f|-file )}" != "$COMP_LINE" ]; then
+            elif [[ $COMP_LINE == *\ -@(*([^ -])f|-file )* ]]; then
                 _filedir
-            elif [ "${COMP_LINE#* -@(*([^ -])g|-group )}" != "$COMP_LINE" ]; then
+            elif [[ $COMP_LINE == *\ -@(*([^ -])g|-group )* ]]; then
                 _rpm_groups
-            elif [ "${COMP_LINE#* -@(*([^ -])p|-package )}" != "$COMP_LINE" ]; then
+            elif [[ $COMP_LINE == *\ -@(*([^ -])p|-package )* ]]; then
                 _filedir 'rpm'
             else
                 _rpm_installed_packages "$nodig" "$nosig"

-- 
bash-completion



More information about the Bash-completion-commits mailing list