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

_jsonschema()
{
    local cur prev words cword
    _init_completion || return

    case $prev in
        --help | --error-format | --validator | -[hFV])
            return
            ;;
        --instance | -i)
            _filedir json
            return
            ;;
    esac

    if [[ $cur == -* ]]; then
        COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur"))
        return
    fi

    local args
    _count_args "" "-*"
    ((args == 1)) || return
    _filedir '@(json|schema)'
} &&
    complete -F _jsonschema jsonschema

# ex: filetype=sh