[yum-commits] Branch 'yum-3_2_X' - etc/yum.bash

Ville Skyttä scop at osuosl.org
Sat Oct 31 09:27:13 UTC 2009


 etc/yum.bash |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

New commits:
commit d9a00c429b1f1520c53188c03b29e8a6fb84535f
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sat Oct 31 11:25:48 2009 +0200

    Move group name bash completion to separate function so it can be used in other tools.

diff --git a/etc/yum.bash b/etc/yum.bash
index 4e013cb..3637ef3 100644
--- a/etc/yum.bash
+++ b/etc/yum.bash
@@ -39,6 +39,17 @@ _yum_repolist()
 }
 
 # arguments:
+#   1 = argument to "yum grouplist" (usually empty (""), or hidden)
+#   2 = current word to be completed
+_yum_grouplist()
+{
+    local IFS=$'\n'
+    # TODO: add -d 0 when http://yum.baseurl.org/ticket/29 is fixed
+    COMPREPLY=( $( compgen -W "$( ${yum:-yum} -C grouplist $1 "$2*" \
+        2>/dev/null | sed -ne 's/^[[:space:]]\+\(.\+\)/\1/p' )" -- "$2" ) )
+}
+
+# arguments:
 #   1 = 1 or 0 to list enabled or disabled plugins
 #   2 = current word to be completed
 _yum_plugins()
@@ -120,10 +131,7 @@ _yum()
             ;;
 
         group*)
-            local IFS=$'\n'
-            # TODO: add -d 0 when http://yum.baseurl.org/ticket/29 is fixed
-            COMPREPLY=( $( compgen -W "$( $yum -C grouplist 2>/dev/null | \
-                sed -ne 's/^[[:space:]]\+\(.\+\)/\1/p' )" -- "$cur" ) )
+            _yum_grouplist "" "$cur"
             return 0
             ;;
 


More information about the Yum-commits mailing list