From ce9bfd82240eebf04c3ae170cc465ffc5abfd5e5 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Wed, 30 Jul 2025 12:33:14 +0100 Subject: [PATCH] [shell-common] Add profile display name to awslogin/logout command --- shell-common/.config/shell-common/functions.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/shell-common/.config/shell-common/functions.sh b/shell-common/.config/shell-common/functions.sh index ddb7a9e..659789c 100644 --- a/shell-common/.config/shell-common/functions.sh +++ b/shell-common/.config/shell-common/functions.sh @@ -98,13 +98,28 @@ function awslogin() { return 2 fi echo "AWS login successful. Credentials exported." + export AWS_PROFILE_ACTIVE="$profile" + if [[ -n "$profile" ]]; then + export AWS_PROFILE_DISPLAY="[aws: $profile]" + else + export AWS_PROFILE_DISPLAY="" + fi +} + +function awslogout() { + unset AWS_PROFILE_ACTIVE + unset AWS_ACCESS_KEY_ID + unset AWS_SECRET_ACCESS_KEY + unset AWS_SESSION_TOKEN + export AWS_PROFILE_DISPLAY="" + echo "AWS profile and credentials cleared." } # easy access to SSH function awsssh() { local profile="" local region="" - local username="ec2-user" + local username="ansible" local search="" # Parse arguments