mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-19 21:41:07 +01:00
allow alternate patterns for using green vs. red depending on AWS_PROFILE
This commit is contained in:
parent
3668ec2a82
commit
be48224280
1 changed files with 12 additions and 5 deletions
|
@ -224,20 +224,27 @@ prompt_status() {
|
||||||
[[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘"
|
[[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘"
|
||||||
[[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡"
|
[[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡"
|
||||||
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙"
|
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙"
|
||||||
|
#
|
||||||
[[ -n "$symbols" ]] && prompt_segment black default "$symbols"
|
[[ -n "$symbols" ]] && prompt_segment black default "$symbols"
|
||||||
}
|
}
|
||||||
|
|
||||||
#AWS Profile:
|
#AWS Profile:
|
||||||
# - display current AWS_PROFILE name
|
# - display current AWS_PROFILE name
|
||||||
# - displays yellow on red if profile name contains 'production' or
|
# - displays yellow on red if profile name matches contents of AWS_SENSITIVE_PROFILES
|
||||||
# ends in '-prod'
|
# if AWS_SENSITIVE_PROFILES is not set, then check if profile name ends with -prod or contains *production*
|
||||||
# - displays black on green otherwise
|
# - displays black on green otherwise
|
||||||
prompt_aws() {
|
prompt_aws() {
|
||||||
[[ -z "$AWS_PROFILE" || "$SHOW_AWS_PROMPT" = false ]] && return
|
[[ -z "$AWS_PROFILE" || "$SHOW_AWS_PROMPT" = false ]] && return
|
||||||
|
|
||||||
|
if [ -z $AWS_SENSITIVE_PROFILES ]; then
|
||||||
|
aws_sensitive_profiles="*-prod|*production*"
|
||||||
|
else
|
||||||
|
aws_sensitive_profiles=$AWS_SENSITIVE_PROFILES
|
||||||
|
fi
|
||||||
|
|
||||||
case "$AWS_PROFILE" in
|
case "$AWS_PROFILE" in
|
||||||
*-prod|*production*) prompt_segment red yellow "AWS: ${AWS_PROFILE:gs/%/%%}" ;;
|
$~aws_sensitive_profiles) prompt_segment red yellow "$AWS_PROFILE" ;;
|
||||||
*) prompt_segment green black "AWS: ${AWS_PROFILE:gs/%/%%}" ;;
|
*) prompt_segment green black "$AWS_PROFILE" ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue