summaryrefslogtreecommitdiff
path: root/plugins/spring/_spring
blob: 93f19517d51344e88637ea665f3c4d324b9ee67f (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
#compdef spring 'spring'
#autoload

_spring() {

        local cword
        let cword=CURRENT-1

        local hints
        hints=()

        local reply
        while read -r line; do
                reply=`echo "$line" | awk '{printf $1 ":"; for (i=2; i<NF; i++) printf $i " "; print $NF}'`
                hints+=("$reply")
        done < <(spring hint ${cword} ${words[*]})

        if ((cword == 1)) {
                _describe -t commands 'commands' hints
                return 0
        }

        _describe -t options 'options' hints
        _files

        return 0
}

_spring "$@"