summaryrefslogtreecommitdiffstats
path: root/completions/chage
blob: f00433d5ad2b6f8498e49f4c1f7926561d2e9ba0 (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
# chage(1) completion                                      -*- shell-script -*-

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

    local noargopts='!(-*|*[dEImMWR]*)'
    # shellcheck disable=SC2254
    case $prev in
        --lastday | --expiredate | --help | --inactive | --mindays | --maxdays | \
            --warndays | -${noargopts}[dEhImMW])
            return
            ;;
        --root | -${noargopts}R)
            _comp_compgen_filedir -d
            return
            ;;
    esac

    [[ $was_split ]] && return

    if [[ $cur == -* ]]; then
        _comp_compgen_help
        return
    fi

    _comp_compgen -- -u
} &&
    complete -F _comp_cmd_chage chage

# ex: filetype=sh