/bash_completion_lib/complete/chkconfig
http://github.com/brinkman83/bashrc · #! · 35 lines · 28 code · 7 blank · 0 comment · 0 complexity · 44fbc7c46537ec48ead04b6b9ff7447f MD5 · raw file
- # chkconfig(8) completion
- comp_include _get_cword _services
- _chkconfig()
- {
- local cur prev
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
- case "$prev" in
- @([1-6]|--@(list|add|del)))
- _services
- return 0
- ;;
- --level)
- COMPREPLY=( $( compgen -W '1 2 3 4 5 6' -- $cur ) )
- return 0
- ;;
- esac
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--list --add --del --level' -- $cur ) )
- else
- if [ $COMP_CWORD -eq 2 -o $COMP_CWORD -eq 4 ]; then
- COMPREPLY=( $( compgen -W 'on off reset' -- $cur ) )
- else
- _services
- fi
- fi
- } # chkconfig()