Skip to content

Instantly share code, notes, and snippets.

@heliohead
Created November 22, 2014 23:24
Show Gist options
  • Save heliohead/d422d315cd6b583038b4 to your computer and use it in GitHub Desktop.
Save heliohead/d422d315cd6b583038b4 to your computer and use it in GitHub Desktop.
#!/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