f9f01e48a890ad4359a6973d1b8a7039f57b2d08
- Author
- Carlo Sala <carlosalag@protonmail.com>
- Committer
- Carlo Sala <carlosalag@protonmail.com>
- Date
Message
fix(aws): do not print region if it's not defined
Closes #11568
Closes #11570
Diff
1diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh
2index 39c47d572a094c039b1deecb0ded71adb1453d6d..0242be97e13b69090e1d0799c5d5237b7d6a2e86 100644
3--- a/plugins/aws/aws.plugin.zsh
4+++ b/plugins/aws/aws.plugin.zsh
5@@ -196,9 +196,15 @@ compctl -K _aws_profiles asp acp aws_change_access_key
6
7 # AWS prompt
8 function aws_prompt_info() {
9- if [[ -z $AWS_REGION && -z $AWS_PROFILE ]];then return; fi
10- region=${AWS_REGION:-${AWS_DEFAULT_REGION:-$AWS_PROFILE_REGION}}
11- echo "${ZSH_THEME_AWS_PROFILE_PREFIX:=<aws:}${AWS_PROFILE}${ZSH_THEME_AWS_PROFILE_SUFFIX:=>} ${ZSH_THEME_AWS_REGION_PREFIX:=<region:}${region}${ZSH_THEME_AWS_REGION_SUFFIX:=>}"
12+ local _aws_to_show
13+ if [[ -n $AWS_PROFILE ]];then
14+ _aws_to_show+="${ZSH_THEME_AWS_PROFILE_PREFIX:=<aws:}${AWS_PROFILE}${ZSH_THEME_AWS_PROFILE_SUFFIX:=>}"
15+ fi
16+ if [[ -n $AWS_REGION ]]; then
17+ [[ -n $AWS_PROFILE ]] && _aws_to_show+=" "
18+ _aws_to_show+="${ZSH_THEME_AWS_REGION_PREFIX:=<region:}${region}${ZSH_THEME_AWS_REGION_SUFFIX:=>}"
19+ fi
20+ echo "$_aws_to_show"
21 }
22
23 if [[ "$SHOW_AWS_PROMPT" != false && "$RPROMPT" != *'$(aws_prompt_info)'* ]]; then