summaryrefslogtreecommitdiff
path: root/completions/chpasswd
blob: 3abea9981dda4249bde0532ad161b4bb8d650766 (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
# chpasswd(8) completion                                   -*- shell-script -*-

_chpasswd()
{
    local cur prev words cword split
    _init_completion -s || return

    case $prev in
        --crypt | -!(-*)c)
            COMPREPLY=($(compgen -W 'DES MD5 NONE SHA256 SHA512' \
                -- "$cur"))
            return
            ;;
        --sha-rounds | -!(-*)s)
            return
            ;;
        --root | -!(-*)R)
            _filedir -d
            return
            ;;
    esac

    $split && return

    COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur"))
    [[ ${COMPREPLY-} == *= ]] && compopt -o nospace
} &&
    complete -F _chpasswd chpasswd

# ex: filetype=sh