summaryrefslogtreecommitdiffstats
path: root/completions/chkconfig
blob: 32c33920f65a4ff7b58e20a45253bd9fb06dc301 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# chkconfig(8) completion                                  -*- shell-script -*-

_comp_cmd_chkconfig()
{
    local cur prev words cword was_split comp_args
    _comp_initialize -s -- "$@" || return

    case $prev in
        --level=[1-6] | [1-6] | --list | --add | --del | --override)
            _comp_compgen_services
            _comp_compgen -a xinetd_services
            return
            ;;
        --level)
            _comp_compgen -- -W '{1..6}'
            return
            ;;
    esac

    [[ $was_split ]] && return

    if [[ $cur == -* ]]; then
        _comp_compgen -- -W '--list --add --del --override --level'
    else
        if ((cword == 2 || cword == 4)); then
            _comp_compgen -- -W 'on off reset resetpriorities'
        else
            _comp_compgen_services
            _comp_compgen -a xinetd_services
        fi
    fi
} &&
    complete -F _comp_cmd_chkconfig chkconfig

# ex: filetype=sh