1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-12-22 21:58:00 +00:00
prezto/modules/aws/functions/aws-info

27 lines
737 B
Plaintext

#
# Exposes information about the AWS_PROFILE environment via the $aws_info associative
# array.
#
# function aws-info {
local profile_format
local profile_formatted
unset aws_info
typeset -gA aws_info
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}${AWS_REGION_PROMPT}"
aws_info[profile]="$profile_formatted"
fi
# }