summaryrefslogtreecommitdiffstats
path: root/completions/geoiplookup
blob: 504c22a06c031cb8eb6b969c33cc5848a6a7ce99 (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
33
# geoiplookup(1) completion                                -*- shell-script -*-

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

    case $prev in
        -h | -'?' | -v)
            return
            ;;
        -d)
            _comp_compgen_filedir -d
            return
            ;;
        -f)
            _comp_compgen_filedir dat
            return
            ;;
    esac

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

    local ipvx
    [[ $1 == *6 ]] && ipvx=-6 || ipvx=-4
    _comp_compgen_known_hosts $ipvx -- "$cur"
} &&
    complete -F _comp_cmd_geoiplookup geoiplookup geoiplookup6

# ex: filetype=sh