Split chkconfig completion to contrib/chkconfig

master
David Paleino 2009-06-05 08:35:24 +02:00
parent 7dbb6a2e3d
commit 69e956e174
4 changed files with 41 additions and 40 deletions

View File

@ -20,6 +20,7 @@ bash-completion (1.x)
* Don't install _subversion anymore
* Split autorpm completion to contrib/autorpm
* Split jar completion to contrib/jar
* Split chkconfig completion to contrib/chkconfig
[ Ville Skyttä ]
* Split yum and yum-arch completion into contrib/yum.

View File

@ -12,6 +12,7 @@ bashcomp_DATA = contrib/ant \
contrib/bluez-utils \
contrib/brctl \
contrib/bzip2 \
contrib/chkconfig \
contrib/cfengine \
contrib/cksfv \
contrib/clisp \

View File

@ -2138,46 +2138,6 @@ _chsh()
}
complete -F _chsh chsh
# chkconfig(8) completion
#
have chkconfig &&
_chkconfig()
{
local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true
case "$prev" in
@(?(--level=)[1-6]|--@(list|add|del|override)))
_services
return 0
;;
--level)
COMPREPLY=( $( compgen -W '1 2 3 4 5 6' -- $cur ) )
return 0
;;
esac
$split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--list --add --del --override \
--level' -- $cur ) )
else
if [ $COMP_CWORD -eq 2 -o $COMP_CWORD -eq 4 ]; then
COMPREPLY=( $( compgen -W 'on off reset \
resetpriorities' -- $cur ) )
else
_services
fi
fi
} &&
complete -F _chkconfig chkconfig
# This function provides simple user@host completion
#
_user_at_host() {

39
contrib/chkconfig Normal file
View File

@ -0,0 +1,39 @@
# chkconfig(8) completion
#
have chkconfig &&
_chkconfig()
{
local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
_split_longopt && split=true
case "$prev" in
@(?(--level=)[1-6]|--@(list|add|del|override)))
_services
return 0
;;
--level)
COMPREPLY=( $( compgen -W '1 2 3 4 5 6' -- $cur ) )
return 0
;;
esac
$split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--list --add --del --override \
--level' -- $cur ) )
else
if [ $COMP_CWORD -eq 2 -o $COMP_CWORD -eq 4 ]; then
COMPREPLY=( $( compgen -W 'on off reset \
resetpriorities' -- $cur ) )
else
_services
fi
fi
} &&
complete -F _chkconfig chkconfig