-
-
Save agargiulo/5807821 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
setopt extendedglob | |
typeset -a boto_web_envs | |
for cfg in `echo ~/.botocfg/(*~*.aws.cfg)`;do | |
boto_web_envs+="${cfg:t:r}" | |
done | |
benv(){ | |
if [[ "$1" == "" ]]; | |
then | |
print "Usage: $0 env-name\n" >&2 | |
print "Valid benv's include:" >&2 | |
print " ${(j:\n:)boto_web_envs}" >&2 | |
return 1 | |
elif [[ "${boto_web_envs[(r)$1]}" != "$1" ]] | |
then | |
print "Invalid benv." >&2 | |
print "Valid benv's include:" >&2 | |
print " ${(j:\n:)boto_web_envs}" >&2 | |
return 2 | |
else | |
export AWS_CREDENTIAL_FILE=~/.botocfg/$1.aws.cfg | |
export BOTO_PATH=/etc/boto.cfg:~/.boto:~/.botocfg/$1.cfg | |
fi | |
} | |
compctl -k boto_web_envs benv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment