summaryrefslogtreecommitdiffstats
path: root/completions/groupadd
blob: fe4e60093b054529bbbba1dbba8335fe6d399284 (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
# groupadd(8) completion                                   -*- shell-script -*-

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

    # TODO: if -o/--non-unique is given, could complete on existing gids
    #       with -g/--gid

    local noargopts='!(-*|*[gKp]*)'
    # shellcheck disable=SC2254
    case $prev in
        --gid | --key | --password | -${noargopts}[gKp])
            return
            ;;
    esac

    [[ $was_split ]] && return

    if [[ $cur == -* ]]; then
        _comp_compgen_help
        [[ ${COMPREPLY-} == *= ]] && compopt -o nospace
    fi
} &&
    complete -F _comp_cmd_groupadd groupadd

# ex: filetype=sh