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