summaryrefslogtreecommitdiffstats
path: root/completions/influx
blob: 89b90e7bf250dd8052ecb8bfbe3647c8bd6bd9ef (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
# bash completion for influx(8)                            -*- shell-script -*-

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

    case $prev in
        -version | -port | -database | -password | -username | -execute | -pps)
            return
            ;;
        -host)
            _comp_compgen_known_hosts -- "$cur"
            return
            ;;
        -format | -precision | -consistency)
            local args=$("$1" --help 2>&1 | _comp_awk "\$1 == \"$prev\" { print \$2 }")
            _comp_compgen -F $' \t\n'"\"'|" -- -W "$args"
            return
            ;;
        -import | -path)
            _comp_compgen_filedir
            return
            ;;
    esac

    [[ $cur == -* ]] &&
        _comp_compgen_help
} &&
    complete -F _comp_cmd_influx influx

# ex: filetype=sh