1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2025-02-02 07:46:48 +00:00

[aws] Add support for showing AWS region in prompt

This commit is contained in:
Daniel Carrillo 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 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' 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" aws_info[profile]="$profile_formatted"
fi fi

View File

@ -7,6 +7,7 @@
# Get the output parameter # Get the output parameter
zstyle -s ':prezto:module:aws' output '_aws_output' || _aws_output='table' zstyle -s ':prezto:module:aws' output '_aws_output' || _aws_output='table'
zstyle -s ':prezto:module:aws' show_region '_aws_region' || _aws_region='false'
zstyle -s ':prezto:module:aws' profile '_aws_profile' || _aws_profile='default' zstyle -s ':prezto:module:aws' profile '_aws_profile' || _aws_profile='default'
# Return if requirements are not found. # Return if requirements are not found.