Created
November 22, 2014 23:24
-
-
Save heliohead/d422d315cd6b583038b4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# bash completion for azk | |
# | |
# If you using zsh needed to.... echo 'autoload -U bashcompinit && bashcompinit' >> ~/.zshrc | |
_azk(){ | |
local cur commands | |
COMPREPLY=() | |
cur=${COMP_WORDS[COMP_CWORD]} | |
prev=${COMP_WORDS[COMP_CWORD-1]} | |
commands="agent shell start stop status scale restart init" | |
if [ $COMP_CWORD == 1 ] | |
then | |
COMPREPLY=($(compgen -W "${commands}" -- ${cur})) | |
return 0 | |
fi | |
if [ $COMP_CWORD == 2 ] | |
then | |
case "$prev" in | |
"agent") | |
local agent_commands="start status stop" | |
COMPREPLY=($(compgen -W "${agent_commands}" -- ${cur})) | |
return 0 | |
;; | |
*) | |
;; | |
esac | |
fi | |
} | |
complete -o default -o nospace -F _azk azk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment