Created
July 14, 2011 21:04
-
-
Save jwgstr/1083437 to your computer and use it in GitHub Desktop.
Stratus Bash Completion
This file contains 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
_stratus() | |
{ | |
local cur prev opts | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" | |
opts="exec list list-storage create-formatted-snapshot" | |
if [[ ${prev} == stratus ]] ; then | |
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) | |
return 0 | |
fi | |
opts=`find ~/.stratus -name "*.cfg" -exec grep "\[.*\]" {} \; | grep -v "DEFAULT" | tr -d "[" | tr -d "]"` | |
if [[ ${prev} == exec ]] ; then | |
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) | |
return 0 | |
fi | |
opts="launch-master launch-slaves terminate-dead-nodes details launch-cluster terminate-cluster login proxy list-storage create-storage delete-storage" | |
prevprev="${COMP_WORDS[COMP_CWORD-2]}" | |
if [[ ${prevprev} == exec ]] ; then | |
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) | |
return 0 | |
fi | |
} | |
complete -F _stratus stratus |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment