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

Ville Skyttä scop at osuosl.org
Sun Jan 16 19:10:15 UTC 2011


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

New commits:
commit 206f1d809460eea97673d2c7c6096667ba576dd0
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sun Jan 16 21:08:30 2011 +0200

    Update conditional use of upstream bash-completion stuff to newer version.

diff --git a/etc/yum.bash b/etc/yum.bash
index f4be628..28deee0 100644
--- a/etc/yum.bash
+++ b/etc/yum.bash
@@ -176,9 +176,13 @@ _yum()
 {
     COMPREPLY=()
     local yum=$1
-    local cur
-    type _get_cword &>/dev/null && cur=`_get_cword` || cur=$2
-    local prev=$3
+    local cur prev
+    local -a words
+    if type _get_comp_words_by_ref &>/dev/null ; then
+        _get_comp_words_by_ref cur prev words
+    else
+        cur=$2 prev=$3 words=("${COMP_WORDS[@]}")
+    fi
     # Commands offered as completions
     local cmds=( check check-update clean deplist distro-sync downgrade
         groupinfo groupinstall grouplist groupremove help history info install
@@ -186,12 +190,12 @@ _yum()
         shell update upgrade version )
 
     local i c cmd subcmd
-    for (( i=1; i < ${#COMP_WORDS[@]}-1; i++ )) ; do
-        [[ -n $cmd ]] && subcmd=${COMP_WORDS[i]} && break
+    for (( i=1; i < ${#words[@]}-1; i++ )) ; do
+        [[ -n $cmd ]] && subcmd=${words[i]} && break
         # Recognize additional commands and aliases
         for c in ${cmds[@]} check-rpmdb distribution-synchronization erase \
             groupupdate grouperase localinstall localupdate whatprovides ; do
-            [[ ${COMP_WORDS[i]} == $c ]] && cmd=$c && break
+            [[ ${words[i]} == $c ]] && cmd=$c && break
         done
     done
 


More information about the Yum-commits mailing list