The following commit has been merged in the master branch:
commit aa2851d54975588a043e7a53434c7d4f1fbbf3fb
Author: Ville Skyttä <[email protected]>
Date:   Mon Mar 30 21:48:09 2009 +0300

    Split yum and yum-arch completion into contrib/yum.

diff --git a/bash_completion b/bash_completion
index 58ea84f..63a5ae4 100644
--- a/bash_completion
+++ b/bash_completion
@@ -6564,122 +6564,6 @@ _mc()
 } &&
 complete -F _mc $filenames mc
 
-# yum(8) completion
-#
-have yum && {
-_yum_list()
-{
-       if [[ "$1" == all ]] ; then
-               # Try to strip in between headings like "Available Packages"
-               # This will obviously only work for English :P
-               COMPREPLY=( $( yum -d 0 -C list $1 "$cur*" 2>/dev/null | \
-                    grep -iv '^\(Available\|Installed\|Updated\) Packages' | \
-                    sed -e 's/[[:space:]].*//' ) )
-       else
-               # Drop first line (e.g. "Updated Packages")
-               COMPREPLY=( $( yum -d 0 -C list $1 "$cur*" 2>/dev/null | \
-                       sed -ne 1d -e 's/[[:space:]].*//p' ) )
-       fi
-}
-
-_yum()
-{
-       local cur prev special
-
-       COMPREPLY=()
-       cur=`_get_cword`
-       prev=${COMP_WORDS[COMP_CWORD-1]}
-
-       for (( i=0; i < ${#comp_wor...@]}-1; i++ )); do
-               if [[ ${COMP_WORDS[i]} == 
@(install|update|upgrade|remove|erase|deplist|info) ]]; then
-                       special=${COMP_WORDS[i]}
-               fi
-       done
-
-       if [ -n "$special" ]; then
-           case $special in
-               install)
-                   _yum_list available
-                   return 0
-                   ;;
-               deplist|info)
-                   _yum_list all
-                   return 0
-                   ;;
-               upgrade|update)
-                   _yum_list updates
-                   return 0
-                   ;;
-               remove|erase)
-                   # _rpm_installed_packages is not arch-qualified
-                   _yum_list installed
-                   return 0
-                   ;;
-               esac
-       fi
-
-       case $cur in
-           --*)
-               COMPREPLY=( $( compgen -W '--installroot --version --help 
--enablerepo --disablerepo --exclude --obsoletes --noplugins' -- $cur ) )
-               return 0
-               ;;
-           -*)
-               COMPREPLY=( $( compgen -W '-c -e -d -y -t -R -C -h' -- $cur ) )
-               return 0
-               ;;
-       esac
-
-       case $prev in
-           list)
-               COMPREPLY=( $( compgen -W 'all available updates installed 
extras obsoletes recent' -- $cur ) )
-               ;;
-           clean)
-               COMPREPLY=( $( compgen -W 'packages headers metadata cache 
dbcache all' -- $cur ) )
-               ;;
-           localinstall|localupdate)
-               # TODO: should not match *src.rpm
-               _filedir rpm
-               ;;
-           -c)
-               _filedir
-               ;;
-           --installroot)
-               _filedir -d
-               ;;
-           *)
-               COMPREPLY=( $( compgen -W 'install update check-update upgrade 
remove list \
-                                               search info provides clean 
groupinstall groupupdate \
-                                               grouplist deplist erase 
groupinfo groupremove \
-                                               localinstall localupdate 
makecache resolvedep \
-                                               shell whatprovides' -- $cur ) )
-               ;;
-       esac
-}
-complete -F _yum $filenames yum
-
-# yum-arch(8) completion
-#
-_yum_arch()
-{
-    local cur
-    COMPREPLY=()
-    cur=`_get_cword`
-
-    case "$cur" in
-       -*)
-           COMPREPLY=( $( compgen -W '-d -v -vv -n -c -z -s -l -q' -- $cur ) )
-           ;;
-       *)
-           _filedir -d
-           ;;
-    esac
-
-    return 0
-
-}
-complete -F _yum_arch $filenames yum-arch
-}
-
 # ImageMagick completion
 #
 have convert && {
diff --git a/contrib/yum b/contrib/yum
new file mode 100644
index 0000000..66bf529
--- /dev/null
+++ b/contrib/yum
@@ -0,0 +1,118 @@
+# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
+# ex: ts=8 sw=8 noet filetype=sh
+
+# yum(8) completion
+#
+have yum && {
+_yum_list()
+{
+       if [[ "$1" == all ]] ; then
+               # Try to strip in between headings like "Available Packages"
+               # This will obviously only work for English :P
+               COMPREPLY=( $( yum -d 0 -C list $1 "$cur*" 2>/dev/null | \
+                    grep -iv '^\(Available\|Installed\|Updated\) Packages' | \
+                    sed -e 's/[[:space:]].*//' ) )
+       else
+               # Drop first line (e.g. "Updated Packages")
+               COMPREPLY=( $( yum -d 0 -C list $1 "$cur*" 2>/dev/null | \
+                       sed -ne 1d -e 's/[[:space:]].*//p' ) )
+       fi
+}
+
+_yum()
+{
+       local cur prev special
+
+       COMPREPLY=()
+       cur=`_get_cword`
+       prev=${COMP_WORDS[COMP_CWORD-1]}
+
+       for (( i=0; i < ${#comp_wor...@]}-1; i++ )); do
+               if [[ ${COMP_WORDS[i]} == 
@(install|update|upgrade|remove|erase|deplist|info) ]]; then
+                       special=${COMP_WORDS[i]}
+               fi
+       done
+
+       if [ -n "$special" ]; then
+           case $special in
+               install)
+                   _yum_list available
+                   return 0
+                   ;;
+               deplist|info)
+                   _yum_list all
+                   return 0
+                   ;;
+               upgrade|update)
+                   _yum_list updates
+                   return 0
+                   ;;
+               remove|erase)
+                   # _rpm_installed_packages is not arch-qualified
+                   _yum_list installed
+                   return 0
+                   ;;
+               esac
+       fi
+
+       case $cur in
+           --*)
+               COMPREPLY=( $( compgen -W '--installroot --version --help 
--enablerepo --disablerepo --exclude --obsoletes --noplugins' -- $cur ) )
+               return 0
+               ;;
+           -*)
+               COMPREPLY=( $( compgen -W '-c -e -d -y -t -R -C -h' -- $cur ) )
+               return 0
+               ;;
+       esac
+
+       case $prev in
+           list)
+               COMPREPLY=( $( compgen -W 'all available updates installed 
extras obsoletes recent' -- $cur ) )
+               ;;
+           clean)
+               COMPREPLY=( $( compgen -W 'packages headers metadata cache 
dbcache all' -- $cur ) )
+               ;;
+           localinstall|localupdate)
+               # TODO: should not match *src.rpm
+               _filedir rpm
+               ;;
+           -c)
+               _filedir
+               ;;
+           --installroot)
+               _filedir -d
+               ;;
+           *)
+               COMPREPLY=( $( compgen -W 'install update check-update upgrade 
remove list \
+                                               search info provides clean 
groupinstall groupupdate \
+                                               grouplist deplist erase 
groupinfo groupremove \
+                                               localinstall localupdate 
makecache resolvedep \
+                                               shell whatprovides' -- $cur ) )
+               ;;
+       esac
+}
+complete -F _yum $filenames yum
+
+# yum-arch(8) completion
+#
+_yum_arch()
+{
+    local cur
+    COMPREPLY=()
+    cur=`_get_cword`
+
+    case "$cur" in
+       -*)
+           COMPREPLY=( $( compgen -W '-d -v -vv -n -c -z -s -l -q' -- $cur ) )
+           ;;
+       *)
+           _filedir -d
+           ;;
+    esac
+
+    return 0
+
+}
+complete -F _yum_arch $filenames yum-arch
+}
diff --git a/debian/changelog b/debian/changelog
index 0f48cb5..d5a2bab 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,9 @@ bash-completion (1:1.x) UNRELEASED; urgency=low
   [ David Paleino ]
   * Prepare for future development.
 
+  [ Ville Skyttä ]
+  * Split yum and yum-arch completion into contrib/yum.
+
  -- David Paleino <[email protected]>  Wed, 25 Mar 2009 23:18:24 +0100
 
 bash-completion (1:1.0-1) UNRELEASED; urgency=low

-- 
bash-completion

_______________________________________________
Bash-completion-commits mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/bash-completion-commits

Reply via email to