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

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

    local noargopts='!(-*|*[F]*)'
    # shellcheck disable=SC2254
    case $prev in
        --help | --version | -${noargopts}[hV])
            return
            ;;
        --file | -${noargopts}F)
            _comp_compgen_filedir
            return
            ;;
    esac

    [[ $cur == -* ]] &&
        _comp_compgen_help || _comp_compgen_usage
} &&
    complete -F _comp_cmd_hostname hostname

# ex: filetype=sh