9139d30ca30f8f687cc21121ed9b4f5238bc5260
- Author
- Roeniss Moon <roeniss2@gmail.com>
- Committer
- GitHub <noreply@github.com>
- Date
Message
feat(aws): allow more customisation in prompt function (#11619)
Diff
1diff --git a/plugins/aws/README.md b/plugins/aws/README.md
2index 54bc7a44d9f969d6444991fd50c0bb5b366a9e48..9e1e055b8e2f0b0962726de3fb1c474481b66ade 100644
3--- a/plugins/aws/README.md
4+++ b/plugins/aws/README.md
5@@ -58,6 +58,8 @@ the current `$AWS_PROFILE` and `$AWS_REGION`. It uses four variables to control
6
7 * ZSH_THEME_AWS_REGION_SUFFIX: sets the suffix of the AWS_REGION. Defaults to `>`.
8
9+* ZSH_THEME_AWS_DIVIDER: sets the divider between ZSH_THEME_AWS_PROFILE_SUFFIX and ZSH_THEME_AWS_REGION_PREFIX. Defaults to ` ` (single space).
10+
11 ## Configuration
12
13 [Configuration and credential file settings](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) by AWS
14diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh
15index d45abba571fb6f80d534f90d82faf446d871cc31..0da91bc22b4f57b9d550d869eecfbc22a9f16950 100644
16--- a/plugins/aws/aws.plugin.zsh
17+++ b/plugins/aws/aws.plugin.zsh
18@@ -223,13 +223,16 @@ compctl -K _aws_profiles asp acp aws_change_access_key
19 function aws_prompt_info() {
20 local _aws_to_show
21 local region="${AWS_REGION:-${AWS_DEFAULT_REGION:-$AWS_PROFILE_REGION}}"
22+
23 if [[ -n $AWS_PROFILE ]];then
24- _aws_to_show+="${ZSH_THEME_AWS_PROFILE_PREFIX:=<aws:}${AWS_PROFILE}${ZSH_THEME_AWS_PROFILE_SUFFIX:=>}"
25+ _aws_to_show+="${ZSH_THEME_AWS_PROFILE_PREFIX="<aws:"}${AWS_PROFILE}${ZSH_THEME_AWS_PROFILE_SUFFIX=">"}"
26 fi
27+
28 if [[ -n $AWS_REGION ]]; then
29- [[ -n $AWS_PROFILE ]] && _aws_to_show+=" "
30- _aws_to_show+="${ZSH_THEME_AWS_REGION_PREFIX:=<region:}${region}${ZSH_THEME_AWS_REGION_SUFFIX:=>}"
31+ [[ -n $AWS_PROFILE ]] && _aws_to_show+="${ZSH_THEME_AWS_DIVIDER=' '}"
32+ _aws_to_show+="${ZSH_THEME_AWS_REGION_PREFIX="<region:"}${region}${ZSH_THEME_AWS_REGION_SUFFIX=">"}"
33 fi
34+
35 echo "$_aws_to_show"
36 }
37