From f9f01e48a890ad4359a6973d1b8a7039f57b2d08 Mon Sep 17 00:00:00 2001 From: Carlo Sala Date: Tue, 21 Mar 2023 15:29:48 +0100 Subject: [PATCH] fix(aws): do not print region if it's not defined Closes #11568 Closes #11570 --- plugins/aws/aws.plugin.zsh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh index 39c47d572..0242be97e 100644 --- a/plugins/aws/aws.plugin.zsh +++ b/plugins/aws/aws.plugin.zsh @@ -196,9 +196,15 @@ compctl -K _aws_profiles asp acp aws_change_access_key # AWS prompt function aws_prompt_info() { - if [[ -z $AWS_REGION && -z $AWS_PROFILE ]];then return; fi - region=${AWS_REGION:-${AWS_DEFAULT_REGION:-$AWS_PROFILE_REGION}} - echo "${ZSH_THEME_AWS_PROFILE_PREFIX:=} ${ZSH_THEME_AWS_REGION_PREFIX:=}" + local _aws_to_show + if [[ -n $AWS_PROFILE ]];then + _aws_to_show+="${ZSH_THEME_AWS_PROFILE_PREFIX:=}" + fi + if [[ -n $AWS_REGION ]]; then + [[ -n $AWS_PROFILE ]] && _aws_to_show+=" " + _aws_to_show+="${ZSH_THEME_AWS_REGION_PREFIX:=}" + fi + echo "$_aws_to_show" } if [[ "$SHOW_AWS_PROMPT" != false && "$RPROMPT" != *'$(aws_prompt_info)'* ]]; then