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

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

    local noargopts='!(-*|*[adAM]*)'
    # shellcheck disable=SC2254
    case $prev in
        --add | --delete | --administrators | --members | -${noargopts}[adAM])
            _comp_compgen -- -u
            return
            ;;
    esac

    if [[ $cur == -* ]]; then
        # TODO: only -A and -M can be combined
        _comp_compgen_help
        return
    fi

    _comp_compgen -- -g
} &&
    complete -F _comp_cmd_gpasswd gpasswd

# ex: filetype=sh