Use _split_longopt in _chkconfig.

This commit is contained in:
Ville Skyttä 2009-04-15 11:20:00 +03:00
parent b556b22d87
commit 78f2e7cd91
2 changed files with 8 additions and 4 deletions

View File

@ -34,8 +34,8 @@ bash-completion (1.x)
input in external command arguments. input in external command arguments.
* Add _split_longopt() helper for improved handling of long options that * Add _split_longopt() helper for improved handling of long options that
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, and * Use _split_longopt to improve and clean up aspell, chgrp, chown, chkconfig,
generic long option completion. and generic long option completion.
* Add chown --from and --reference value completions. * Add chown --from and --reference value completions.
* Add chgrp --reference value completion. * Add chgrp --reference value completion.
* Do not assume all --foo= options take filenames in generic long option * Do not assume all --foo= options take filenames in generic long option

View File

@ -2636,14 +2636,16 @@ complete -F _chsh chsh
have chkconfig && have chkconfig &&
_chkconfig() _chkconfig()
{ {
local cur prev local cur prev split=false
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true
case "$prev" in case "$prev" in
@([1-6]|--@(list|add|del))) @(?(--level=)[1-6]|--@(list|add|del|override)))
_services _services
return 0 return 0
;; ;;
@ -2653,6 +2655,8 @@ _chkconfig()
;; ;;
esac esac
$split && return 0
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--list --add --del --override \ COMPREPLY=( $( compgen -W '--list --add --del --override \
--level' -- $cur ) ) --level' -- $cur ) )