83d11394321398b99911089901b905574807ccfb

Author
Rob Lugton <roblugton@users.noreply.github.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

agnoster: show AWS_PROFILE in prompt (#6621)

Diff

 1diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
 2index 0edb773aac7183a17c64df154e3db9440c303155..3c30a9e1140ea747f5721bdfd5fc73d2bc9a132d 100644
 3--- a/themes/agnoster.zsh-theme
 4+++ b/themes/agnoster.zsh-theme
 5@@ -224,11 +224,25 @@ prompt_status() {
 6   [[ -n "$symbols" ]] && prompt_segment black default "$symbols"
 7 }
 8 
 9+#AWS Profile:
10+# - display current AWS_PROFILE name
11+# - displays yellow on red if profile name contains 'production' or
12+#   ends in '-prod'
13+# - displays black on green otherwise
14+prompt_aws() {
15+  [[ -z "$AWS_PROFILE" ]] && return
16+  case "$AWS_PROFILE" in
17+    *-prod|*production*) prompt_segment red yellow  "AWS: $AWS_PROFILE" ;;
18+    *) prompt_segment green black "AWS: $AWS_PROFILE" ;;
19+  esac
20+}
21+
22 ## Main prompt
23 build_prompt() {
24   RETVAL=$?
25   prompt_status
26   prompt_virtualenv
27+  prompt_aws
28   prompt_context
29   prompt_dir
30   prompt_git