From 01271d0ad68985f1a9476bd8f93a9a2dc3f955d5 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Sat, 5 Sep 2026 16:13:08 -0700 Subject: [PATCH] fix(aws): stop listing sso-session blocks as profiles The fallback used when the aws binary is missing matched every bracketed header, so 'aws_profiles' emitted '[sso-session name]' and '[services name]' verbatim alongside real profile names. Only match headers that hold a single unspaced name, optionally prefixed with 'profile'. Co-Authored-By: Claude Opus 5 (1M context) --- plugins/aws/aws.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh index c78531db1..6de58ef20 100644 --- a/plugins/aws/aws.plugin.zsh +++ b/plugins/aws/aws.plugin.zsh @@ -241,7 +241,7 @@ function aws_regions() { 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' + grep --color=never -Eo '^\[[[:space:]]*(profile[[:space:]]+)?[^][:space:]]+[[:space:]]*\]' "${AWS_CONFIG_FILE:-$HOME/.aws/config}" | sed -E 's/^\[[[:space:]]*(profile[[:space:]]+)?([^][:space:]]+)[[:space:]]*\]$/\2/' } function _aws_regions() {