1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-09-21 07:20:09 +00:00

feat(aws): load profiles from credentials file (#11196)

Fixes #8472
This commit is contained in:
Noam Cohen 2023-01-13 15:35:30 +02:00 committed by GitHub
parent ec0003f2fa
commit eb2147c715
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -146,6 +146,7 @@ function aws_change_access_key() {
}
function aws_profiles() {
aws --no-cli-pager configure list-profiles 2> /dev/null && return
[[ -r "${AWS_CONFIG_FILE:-$HOME/.aws/config}" ]] || return 1
grep --color=never -Eo '\[.*\]' "${AWS_CONFIG_FILE:-$HOME/.aws/config}" | sed -E 's/^[[:space:]]*\[(profile)?[[:space:]]*([^[:space:]]+)\][[:space:]]*$/\2/g'
}