1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2025-07-01 19:49:25 +00:00

[aws] Add support for showing AWS region in prompt

This commit is contained in:
2020-02-20 18:43:05 +01:00
parent 47b37b22ea
commit 3d827cdb88
2 changed files with 8 additions and 2 deletions

View File

@ -12,9 +12,14 @@ unset aws_info
typeset -gA aws_info
if [[ -n "$AWS_PROFILE" ]]; then
if (( ${+AWS_PROFILE} )); then
if (( ${+AWS_DEFAULT_REGION+1} )) && [[ ${_aws_region} = "true" ]]; then
AWS_REGION=$(cut -d "-" -f 1 <<<$AWS_DEFAULT_REGION | cut -b 1)$(cut -d "-" -f 2 <<<$AWS_DEFAULT_REGION | cut -b 1)$(cut -d "-" -f 3 <<<$AWS_DEFAULT_REGION | cut -b 1)
AWS_REGION_PROMPT=" $AWS_REGION"
fi
zstyle -s ':prezto:module:aws:info:profile' format 'profile_format'
zformat -f profile_formatted "$profile_format" "v:${AWS_PROFILE:t}"
zformat -f profile_formatted "$profile_format" "v:${AWS_PROFILE:t}${AWS_REGION_PROMPT}"
aws_info[profile]="$profile_formatted"
fi