PageRenderTime 136ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 132ms app.codeStats 0ms

/bash_completion_lib/complete/chkconfig

http://github.com/brinkman83/bashrc
#! | 35 lines | 28 code | 7 blank | 0 comment | 0 complexity | 44fbc7c46537ec48ead04b6b9ff7447f MD5 | raw file
 1# chkconfig(8) completion
 2
 3
 4comp_include _get_cword _services
 5
 6
 7_chkconfig()
 8{
 9    local cur prev
10
11    COMPREPLY=()
12    cur=`_get_cword`
13    prev=${COMP_WORDS[COMP_CWORD-1]}
14
15    case "$prev" in
16    @([1-6]|--@(list|add|del)))
17        _services
18        return 0
19        ;;
20    --level)
21        COMPREPLY=( $( compgen -W '1 2 3 4 5 6' -- $cur ) )
22        return 0
23        ;;
24    esac
25
26    if [[ "$cur" == -* ]]; then
27        COMPREPLY=( $( compgen -W '--list --add --del --level' -- $cur ) )
28    else
29        if [ $COMP_CWORD -eq 2 -o $COMP_CWORD -eq 4 ]; then
30            COMPREPLY=( $( compgen -W 'on off reset' -- $cur ) )
31        else
32            _services
33        fi
34    fi
35} # chkconfig()