Skip to content

Instantly share code, notes, and snippets.

Created June 18, 2013 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/5807819 to your computer and use it in GitHub Desktop.
Save anonymous/5807819 to your computer and use it in GitHub Desktop.
benv(){
if [[ "$1" == "" ]];
then
print "Usage: $0 env-name\n" >&2
print "Valid benv's include:" >&2
for benv in $boto_web_envs;do
print " $benv" >&2
done
return 1
elif [[ "${boto_web_envs[(r)$1]}" != "$1" ]]
then
print "Invalid benv.\nValid options are: '`print $boto_web_envs | python -c "print ', '.join(raw_input().split(' '))"`'" >&2
return 2
else
export AWS_CREDENTIAL_FILE=~/.botocfg/$1.aws.cfg
export BOTO_PATH=/etc/boto.cfg:~/.boto:~/.botocfg/$1.cfg
fi
}
typeset -a boto_web_envs
for cfg in `ls ~/.botocfg/*.cfg | grep -v .aws.cfg`;do
boto_web_envs+="${cfg:t:r}"
done
compctl -k boto_web_envs benv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment