Skip to content

Instantly share code, notes, and snippets.

@ezmac
Last active December 3, 2018 14:12
Show Gist options
  • Save ezmac/125e4116885eb591d7f4c06cd335c604 to your computer and use it in GitHub Desktop.
Save ezmac/125e4116885eb591d7f4c06cd335c604 to your computer and use it in GitHub Desktop.
AWS profile zsh prompt indicator
prompt_aws() {
repo_path=$(git rev-parse --git-dir 2>/dev/null)
if [[ -z $AWS_PROFILE ]]; then
return
fi
if [[ ! -z $AWS_PROFILE ]]; then
if [[ $AWS_PROFILE == *"prod"* || $AWS_PROFILE == ${PROD_AWS_PROFILE} ]]; then
prompt_segment red white
else
prompt_segment green black
fi
setopt promptsubst
echo -n "☁️ $AWS_PROFILE"
fi
}
# used to set a prompt indicator for aws profile;
# Allows setting a PROD_AWS_PROFILE env var if your aws prod profile does not contain the word "prod"
# for in place example, check https://github.com/ezmac/dotfiles/blob/master/ezmac.zsh-theme
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment