diff --git a/CHANGES b/CHANGES index 96ccdf0b..96c20773 100644 --- a/CHANGES +++ b/CHANGES @@ -39,8 +39,8 @@ bash-completion (1.x) * Split yum and yum-arch completion into contrib/yum. * Install yum-arch completion only if yum-arch is installed. * Update list of yum commands and options. - * Add yum repolist, --enable/disablerepo, --disableexcludes, -d, and -e - completions. + * Add yum repolist, --enable/disablerepo, --disableexcludes, -d, -e, and + --color completions. * Add chkconfig --override and resetpriorities completions. * Split mplayer and friends completions to contrib/mplayer. * Parse top level mplayer and friends option completions from -list-options. @@ -65,7 +65,7 @@ bash-completion (1.x) take arguments in both "--foo bar" and "--foo=bar" formats. * Use _split_longopt to improve and clean up aspell, chgrp, chown, chkconfig, cpio, dpkg, iptables, make, mc, mii-diag, mii-tool, mkinitrd, pkg-config, - postgresql, quota, samba, smartctl, and generic long option completion + postgresql, quota, samba, smartctl, yum, and generic long option completion (Alioth: #311398). * Add chown --from and --reference value completions. * Add chgrp --reference value completion. diff --git a/contrib/yum b/contrib/yum index 0cf06d80..ac757855 100644 --- a/contrib/yum +++ b/contrib/yum @@ -30,7 +30,7 @@ _yum_repolist() _yum() { - local cur prev special + local cur prev special split=false COMPREPLY=() cur=`_get_cword` @@ -69,15 +69,7 @@ _yum() esac fi - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-h --help -t --tolerant -C -c -R \ - -d --showduplicates -e -q --quiet -v --verbose -y \ - --version --installroot --enablerepo --disablerepo -x \ - --exclude --disableexcludes --obsoletes --noplugins \ - --nogpgcheck --disableplugin --enableplugin \ - --skip-broken --color' -- $cur ) ) - return 0 - fi + _split_longopt && split=true case $prev in list) @@ -118,6 +110,17 @@ _yum() COMPREPLY=( $( compgen -W '$( _yum_repolist all ) \ all main' -- $cur ) ) ;; + --color) + COMPREPLY=( $( compgen -W 'always auto never' -- $cur )) + ;; + -R|-x|--exclude) + # argument required but no completions available + return 0 + ;; + -h|--help|--version) + # no other options useful with these + return 0 + ;; *) COMPREPLY=( $( compgen -W 'install update \ check-update upgrade remove erase list info \ @@ -128,6 +131,18 @@ _yum() help' -- $cur ) ) ;; esac + + $split && return 0 + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-h --help -t --tolerant -C -c -R \ + -d --showduplicates -e -q --quiet -v --verbose -y \ + --version --installroot --enablerepo --disablerepo -x \ + --exclude --disableexcludes --obsoletes --noplugins \ + --nogpgcheck --disableplugin --enableplugin \ + --skip-broken --color' -- $cur ) ) + return 0 + fi } } && complete -F _yum $filenames yum