mirror of
https://github.com/dcarrillo/prezto.git
synced 2024-12-22 21:58:00 +00:00
34 lines
956 B
Plaintext
34 lines
956 B
Plaintext
#
|
|
# Exposes information about the AWS_PROFILE environment via the $aws_info associative
|
|
# array.
|
|
#
|
|
|
|
# function aws-info {
|
|
|
|
local profile_format
|
|
local profile_formatted
|
|
local aws_prompt
|
|
local aws_region_prompt
|
|
|
|
unset aws_info
|
|
typeset -gA aws_info
|
|
|
|
if (( ${+AWS_SECRET_ACCESS_KEY} )); then
|
|
aws_prompt='ACCESS_KEY'
|
|
elif (( ${+AWS_PROFILE} )); then
|
|
aws_prompt=$AWS_PROFILE
|
|
|
|
if (( ${+AWS_DEFAULT_REGION} )) && [[ ${_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
|
|
fi
|
|
|
|
if (( ${+AWS_SECRET_ACCESS_KEY} )) || (( ${+AWS_DEFAULT_REGION} )); then
|
|
zstyle -s ':prezto:module:aws:info:profile' format 'profile_format'
|
|
zformat -f profile_formatted "$profile_format" "v:${aws_prompt:t}${aws_region_prompt}"
|
|
aws_info[profile]="$profile_formatted"
|
|
fi
|
|
|
|
# }
|