]>
Commit | Line | Data |
---|---|---|
89dcabae ER |
1 | have webapp && { |
2 | ||
3 | # webapp(1) completion | |
4 | # | |
5 | _webapp() | |
6 | { | |
7 | local cur prev | |
8 | ||
9 | COMPREPLY=() | |
10 | cur=${COMP_WORDS[COMP_CWORD]} | |
11 | prev=${COMP_WORDS[COMP_CWORD-1]} | |
12 | ||
13 | case "$COMP_CWORD" in | |
14 | 1) | |
15 | COMPREPLY=($( compgen -W 'register unregister list list-apps' -- $cur )) | |
16 | ;; | |
17 | 2) | |
18 | case "$prev" in | |
19 | register|unregister|list) | |
20 | COMPREPLY=($( compgen -W 'apache httpd lighttpd' -- $cur )) | |
21 | ;; | |
22 | esac | |
23 | ;; | |
24 | 3) | |
25 | case "${COMP_WORDS[COMP_CWORD-2]}" in | |
26 | register) | |
27 | COMPREPLY=($( compgen -W "$(webapp list-apps-unregistered $prev)" -- $cur )) | |
28 | ;; | |
29 | unregister) | |
30 | COMPREPLY=($( compgen -W "$(webapp list-apps-registered $prev)" -- $cur )) | |
31 | ;; | |
32 | esac | |
33 | ;; | |
34 | esac | |
35 | ||
36 | # return 0 | |
37 | } | |
38 | ||
39 | complete -F _webapp webapp | |
40 | } |