Created
June 18, 2013 18:08
-
-
Save anonymous/5807819 to your computer and use it in GitHub Desktop.
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
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