Use _split_longopt with yum, add some option (non-)completions.
This commit is contained in:
parent
a2c2227d1d
commit
b69961b257
6
CHANGES
6
CHANGES
@ -39,8 +39,8 @@ bash-completion (1.x)
|
|||||||
* Split yum and yum-arch completion into contrib/yum.
|
* Split yum and yum-arch completion into contrib/yum.
|
||||||
* Install yum-arch completion only if yum-arch is installed.
|
* Install yum-arch completion only if yum-arch is installed.
|
||||||
* Update list of yum commands and options.
|
* Update list of yum commands and options.
|
||||||
* Add yum repolist, --enable/disablerepo, --disableexcludes, -d, and -e
|
* Add yum repolist, --enable/disablerepo, --disableexcludes, -d, -e, and
|
||||||
completions.
|
--color completions.
|
||||||
* Add chkconfig --override and resetpriorities completions.
|
* Add chkconfig --override and resetpriorities completions.
|
||||||
* Split mplayer and friends completions to contrib/mplayer.
|
* Split mplayer and friends completions to contrib/mplayer.
|
||||||
* Parse top level mplayer and friends option completions from -list-options.
|
* 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.
|
take arguments in both "--foo bar" and "--foo=bar" formats.
|
||||||
* Use _split_longopt to improve and clean up aspell, chgrp, chown, chkconfig,
|
* Use _split_longopt to improve and clean up aspell, chgrp, chown, chkconfig,
|
||||||
cpio, dpkg, iptables, make, mc, mii-diag, mii-tool, mkinitrd, pkg-config,
|
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).
|
(Alioth: #311398).
|
||||||
* Add chown --from and --reference value completions.
|
* Add chown --from and --reference value completions.
|
||||||
* Add chgrp --reference value completion.
|
* Add chgrp --reference value completion.
|
||||||
|
35
contrib/yum
35
contrib/yum
@ -30,7 +30,7 @@ _yum_repolist()
|
|||||||
|
|
||||||
_yum()
|
_yum()
|
||||||
{
|
{
|
||||||
local cur prev special
|
local cur prev special split=false
|
||||||
|
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
cur=`_get_cword`
|
cur=`_get_cword`
|
||||||
@ -69,15 +69,7 @@ _yum()
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
_split_longopt && split=true
|
||||||
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
|
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
list)
|
list)
|
||||||
@ -118,6 +110,17 @@ _yum()
|
|||||||
COMPREPLY=( $( compgen -W '$( _yum_repolist all ) \
|
COMPREPLY=( $( compgen -W '$( _yum_repolist all ) \
|
||||||
all main' -- $cur ) )
|
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 \
|
COMPREPLY=( $( compgen -W 'install update \
|
||||||
check-update upgrade remove erase list info \
|
check-update upgrade remove erase list info \
|
||||||
@ -128,6 +131,18 @@ _yum()
|
|||||||
help' -- $cur ) )
|
help' -- $cur ) )
|
||||||
;;
|
;;
|
||||||
esac
|
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
|
complete -F _yum $filenames yum
|
||||||
|
Loading…
x
Reference in New Issue
Block a user