_spring
593 bytes
1#compdef spring 'spring'
2#autoload
3
4_spring() {
5
6 local cword
7 let cword=CURRENT-1
8
9 local hints
10 hints=()
11
12 local reply
13 while read -r line; do
14 reply=`echo "$line" | awk '{printf $1 ":"; for (i=2; i<NF; i++) printf $i " "; print $NF}'`
15 hints+=("$reply")
16 done < <(spring hint ${cword} ${words[*]})
17
18 if ((cword == 1)) {
19 _describe -t commands 'commands' hints
20 return 0
21 }
22
23 _describe -t options 'options' hints
24 _files
25
26 return 0
27}
28
29_spring "$@"