Last active
December 3, 2018 14:12
-
-
Save ezmac/125e4116885eb591d7f4c06cd335c604 to your computer and use it in GitHub Desktop.
AWS profile zsh prompt indicator
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
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