From: Elan Ruusamäe Date: Fri, 29 Sep 2006 10:47:48 +0000 (+0000) Subject: - initial, works X-Git-Tag: auto/ac/webapps-0_3-1~2 X-Git-Url: http://git.pld-linux.org/?a=commitdiff_plain;ds=sidebyside;h=89dcabaea4ba1d600180bf068f9f1c701c21e245;p=packages%2Fwebapps.git - initial, works Changed files: webapp-bash_completion.sh -> 1.1 --- diff --git a/webapp-bash_completion.sh b/webapp-bash_completion.sh new file mode 100644 index 0000000..0ef94c3 --- /dev/null +++ b/webapp-bash_completion.sh @@ -0,0 +1,40 @@ +have webapp && { + +# webapp(1) completion +# +_webapp() +{ + local cur prev + + COMPREPLY=() + cur=${COMP_WORDS[COMP_CWORD]} + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$COMP_CWORD" in + 1) + COMPREPLY=($( compgen -W 'register unregister list list-apps' -- $cur )) + ;; + 2) + case "$prev" in + register|unregister|list) + COMPREPLY=($( compgen -W 'apache httpd lighttpd' -- $cur )) + ;; + esac + ;; + 3) + case "${COMP_WORDS[COMP_CWORD-2]}" in + register) + COMPREPLY=($( compgen -W "$(webapp list-apps-unregistered $prev)" -- $cur )) + ;; + unregister) + COMPREPLY=($( compgen -W "$(webapp list-apps-registered $prev)" -- $cur )) + ;; + esac + ;; + esac + +# return 0 +} + +complete -F _webapp webapp +}