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

Ville Skyttä scop at osuosl.org
Sun Apr 24 15:40:43 UTC 2011


 etc/yum.bash |   42 ++++++++++++++++++++++++++++--------------
 1 file changed, 28 insertions(+), 14 deletions(-)

New commits:
commit 43a7873c389b4d2e9cd354580906b9bcfaba7955
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sun Apr 24 18:38:46 2011 +0300

    Add history info|list|summary completions.

diff --git a/etc/yum.bash b/etc/yum.bash
index eb2cc91..b3be29b 100644
--- a/etc/yum.bash
+++ b/etc/yum.bash
@@ -83,6 +83,12 @@ _yum_baseopts()
     printf %s "$opts"
 }
 
+_yum_transactions()
+{
+    COMPREPLY+=( $( compgen -W "$( $yum -d 0 -C history 2>/dev/null | \
+        sed -ne 's/^[[:space:]]*\([0-9]\{1,\}\).*/\1/p' )" -- "$cur" ) )
+}
+
 # arguments:
 #   1 = current word to be completed
 #   2 = previous word
@@ -261,15 +267,24 @@ _yum()
             fi
             case $subcmd in
                 undo|redo|repeat|addon|addon-info|rollback)
-                    COMPREPLY=( $( compgen -W "last $( $yum -d 0 -C history \
-                        2>/dev/null | \
-                        sed -ne 's/^[[:space:]]*\([0-9]\{1,\}\).*/\1/p' )" \
+                    _yum_transactions
+                    COMPREPLY=( $( compgen -W "${COMPREPLY[@]} last" \
                         -- "$cur" ) )
                     ;;
                 package-list|pkg|pkgs|pkg-list|pkgs-list|package|packages|\
                 packages-list)
                     _yum_list available "$cur"
                     ;;
+                info|list|summary)
+                    _yum_transactions
+                    if [[ $subcmd != info ]] ; then
+                        COMPREPLY=( $( compgen -W "${COMPREPLY[@]} all" \
+                            -- "$cur" ) )
+                        [[ $cur != all ]] && _yum_list available "$cur"
+                    else
+                        _yum_list available "$cur"
+                    fi
+                    ;;
             esac
             return 0
             ;;
commit 192ff6544eb311889e24c39d47ea8160ed1141b1
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sun Apr 24 18:34:42 2011 +0300

    Add history rollback completion.

diff --git a/etc/yum.bash b/etc/yum.bash
index a58554b..eb2cc91 100644
--- a/etc/yum.bash
+++ b/etc/yum.bash
@@ -256,11 +256,11 @@ _yum()
         history)
             if [[ $prev == $cmd ]] ; then
                 COMPREPLY=( $( compgen -W 'info list summary undo redo new
-                    addon-info package-list' -- "$cur" ) )
+                    addon-info package-list rollback' -- "$cur" ) )
                 return 0
             fi
             case $subcmd in
-                undo|redo|repeat|addon|addon-info)
+                undo|redo|repeat|addon|addon-info|rollback)
                     COMPREPLY=( $( compgen -W "last $( $yum -d 0 -C history \
                         2>/dev/null | \
                         sed -ne 's/^[[:space:]]*\([0-9]\{1,\}\).*/\1/p' )" \
commit aa33d08a3199395289f0ec99d56a4fc805d822ce
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sun Apr 24 18:33:04 2011 +0300

    Completion code cleanups.

diff --git a/etc/yum.bash b/etc/yum.bash
index c01bb7e..a58554b 100644
--- a/etc/yum.bash
+++ b/etc/yum.bash
@@ -254,19 +254,18 @@ _yum()
             ;;
 
         history)
-            case $prev in
-                $cmd)
-                    COMPREPLY=( $( compgen -W 'info list summary undo redo
-                        new addon-info package-list' -- "$cur" ) )
-                    ;;
+            if [[ $prev == $cmd ]] ; then
+                COMPREPLY=( $( compgen -W 'info list summary undo redo new
+                    addon-info package-list' -- "$cur" ) )
+                return 0
+            fi
+            case $subcmd in
                 undo|redo|repeat|addon|addon-info)
                     COMPREPLY=( $( compgen -W "last $( $yum -d 0 -C history \
                         2>/dev/null | \
                         sed -ne 's/^[[:space:]]*\([0-9]\{1,\}\).*/\1/p' )" \
                         -- "$cur" ) )
                     ;;
-            esac
-            case $subcmd in
                 package-list|pkg|pkgs|pkg-list|pkgs-list|package|packages|\
                 packages-list)
                     _yum_list available "$cur"
commit 8941f231b94c5aa11a677ade9a1030cea5da353e
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sun Apr 24 18:28:04 2011 +0300

    Complete history packages-list on available instead of installed packages.

diff --git a/etc/yum.bash b/etc/yum.bash
index a482d25..c01bb7e 100644
--- a/etc/yum.bash
+++ b/etc/yum.bash
@@ -269,7 +269,7 @@ _yum()
             case $subcmd in
                 package-list|pkg|pkgs|pkg-list|pkgs-list|package|packages|\
                 packages-list)
-                    _yum_list installed "$cur"
+                    _yum_list available "$cur"
                     ;;
             esac
             return 0
commit b00c7916c18d5fcc5d97f6c7e916b15cf16a4df1
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sun Apr 24 18:24:05 2011 +0300

    Use "declare -F" instead of "type" to check if a bash function exists.
    
    Avoids some stat() calls when it doesn't.

diff --git a/etc/yum.bash b/etc/yum.bash
index cdc66ad..a482d25 100644
--- a/etc/yum.bash
+++ b/etc/yum.bash
@@ -90,7 +90,7 @@ _yum_baseopts()
 _yum_complete_baseopts()
 {
     local split=false
-    type _split_longopt &>/dev/null && _split_longopt && split=true
+    declare -F _split_longopt &>/dev/null && _split_longopt && split=true
 
     case $2 in
 
@@ -177,7 +177,7 @@ _yum()
     local yum=$1
     local cur prev
     local -a words
-    if type _get_comp_words_by_ref &>/dev/null ; then
+    if declare -F _get_comp_words_by_ref &>/dev/null ; then
         _get_comp_words_by_ref cur prev words
     else
         cur=$2 prev=$3 words=("${COMP_WORDS[@]}")


More information about the Yum-commits mailing list