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

_comp_cmd_groupmod()
{
    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='!(-*|*[gnp]*)'
    # shellcheck disable=SC2254
    case $prev in
        --gid | --help | --new-name | --password | -${noargopts}[ghnp])
            return
            ;;
    esac

    [[ $was_split ]] && return

    if [[ $cur == -* ]]; then
        _comp_compgen_help
        [[ ${COMPREPLY-} == *= ]] && compopt -o nospace
        return
    fi

    _comp_compgen -- -g
} &&
    complete -F _comp_cmd_groupmod groupmod

# ex: filetype=sh