| [ -z "$BASH_VERSION" ] && return |
| #################################################################################################### |
| COMPREPLY=($(compgen -W "help version list-apps launch action list-actions" -- "${COMP_WORDS[1]}")) |
| case "${COMP_WORDS[1]}" in |
| launch|action|list-actions) |
| COMPREPLY=($(compgen -W "`gapplication list-apps`" -- "${COMP_WORDS[2]}")) |
| # Otherwise, what we will do is based on the command in ${COMP_WORDS[1]} |
| case "${COMP_WORDS[1]}" in |
| # Word 3 is the action name. This is the only one we can help with. |
| if [ "${COMP_CWORD}" == 3 ]; then |
| COMPREPLY=($(compgen -W "`gapplication list-actions "${COMP_WORDS[2]}"`" -- "${COMP_WORDS[3]}")) |
| COMPREPLY=($(compgen -A file "${COMP_WORDS[COMP_CWORD]}")) |
| # Nothing else should be out this far... |
| #################################################################################################### |
| complete -F __app gapplication |