diff options
Diffstat (limited to 'completions/chkconfig')
-rw-r--r-- | completions/chkconfig | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/completions/chkconfig b/completions/chkconfig index 2d02e56e..31a575e3 100644 --- a/completions/chkconfig +++ b/completions/chkconfig @@ -1,14 +1,9 @@ -# chkconfig(8) completion +# chkconfig(8) completion -*- shell-script -*- -have chkconfig && _chkconfig() { - local cur prev split=false - - COMPREPLY=() - _get_comp_words_by_ref cur prev - - _split_longopt && split=true + local cur prev words cword split + _init_completion -s || return case $prev in --level=[1-6]|[1-6]|--list|--add|--del|--override) @@ -16,7 +11,7 @@ _chkconfig() return 0 ;; --level) - COMPREPLY=( $( compgen -W '1 2 3 4 5 6' -- "$cur" ) ) + COMPREPLY=( $( compgen -W '{1..6}' -- "$cur" ) ) return 0 ;; esac @@ -26,7 +21,7 @@ _chkconfig() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--list --add --del --override --level' -- "$cur" ) ) else - if [[ $COMP_CWORD -eq 2 || $COMP_CWORD -eq 4 ]]; then + if [[ $cword -eq 2 || $cword -eq 4 ]]; then COMPREPLY=( $( compgen -W 'on off reset resetpriorities' -- "$cur" ) ) else _services @@ -35,10 +30,4 @@ _chkconfig() } && complete -F _chkconfig chkconfig -# Local variables: -# mode: shell-script -# sh-basic-offset: 4 -# sh-indent-comment: t -# indent-tabs-mode: nil -# End: # ex: ts=4 sw=4 et filetype=sh |