From 8d155c4693b559605ce9dac21ce58199943fa5a9 Mon Sep 17 00:00:00 2001 From: minjcho <131win1@gmail.com> Date: Fri, 16 Jan 2026 15:49:25 +0900 Subject: [PATCH 1/3] Add fish shell format for export-credentials (#9670) --- awscli/customizations/configure/exportcreds.py | 10 ++++++++++ .../customizations/configure/test_exportcreds.py | 16 ++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/awscli/customizations/configure/exportcreds.py b/awscli/customizations/configure/exportcreds.py index f08b262b2582..38c730ce4bc0 100644 --- a/awscli/customizations/configure/exportcreds.py +++ b/awscli/customizations/configure/exportcreds.py @@ -117,6 +117,15 @@ class WindowsCmdFormatter(BasePerLineFormatter): _VAR_FORMAT = 'set {var_name}={var_value}' +class FishShellFormatter(BasePerLineFormatter): + FORMAT = 'fish' + DOCUMENTATION = ( + 'Display credentials as Fish shell environment variables: ' + '``set -gx AWS_ACCESS_KEY_ID EXAMPLE``' + ) + _VAR_FORMAT = 'set -gx {var_name} {var_value}' + + class CredentialProcessFormatter(BaseCredentialFormatter): FORMAT = 'process' DOCUMENTATION = ( @@ -152,6 +161,7 @@ def display_credentials(self, credentials): BashNoExportEnvFormatter, PowershellFormatter, WindowsCmdFormatter, + FishShellFormatter, ] } diff --git a/tests/unit/customizations/configure/test_exportcreds.py b/tests/unit/customizations/configure/test_exportcreds.py index 566ec524366e..e131ed9f48a4 100644 --- a/tests/unit/customizations/configure/test_exportcreds.py +++ b/tests/unit/customizations/configure/test_exportcreds.py @@ -26,6 +26,7 @@ ConfigureExportCredentialsCommand, CredentialProcessFormatter, Credentials, + FishShellFormatter, PowershellFormatter, WindowsCmdFormatter, convert_botocore_credentials, @@ -109,6 +110,21 @@ def __eq__(self, other): ), ), ), + ( + FishShellFormatter, + ( + ( + 'set -gx AWS_ACCESS_KEY_ID access_key\n' + 'set -gx AWS_SECRET_ACCESS_KEY secret_key\n' + ), + ( + 'set -gx AWS_ACCESS_KEY_ID access_key\n' + 'set -gx AWS_SECRET_ACCESS_KEY secret_key\n' + 'set -gx AWS_SESSION_TOKEN token\n' + 'set -gx AWS_CREDENTIAL_EXPIRATION 2023-01-01T00:00:00Z\n' + ), + ), + ), ( CredentialProcessFormatter, ( From 1c5457795b3a8446fefc94d31313ec465b22c444 Mon Sep 17 00:00:00 2001 From: minjcho <131win1@gmail.com> Date: Wed, 21 Jan 2026 11:40:45 +0900 Subject: [PATCH 2/3] Quote fish shell values for special characters --- awscli/customizations/configure/exportcreds.py | 4 ++-- .../customizations/configure/test_exportcreds.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/awscli/customizations/configure/exportcreds.py b/awscli/customizations/configure/exportcreds.py index 38c730ce4bc0..32f23d6f2a3c 100644 --- a/awscli/customizations/configure/exportcreds.py +++ b/awscli/customizations/configure/exportcreds.py @@ -121,9 +121,9 @@ class FishShellFormatter(BasePerLineFormatter): FORMAT = 'fish' DOCUMENTATION = ( 'Display credentials as Fish shell environment variables: ' - '``set -gx AWS_ACCESS_KEY_ID EXAMPLE``' + '``set -gx AWS_ACCESS_KEY_ID "EXAMPLE"``' ) - _VAR_FORMAT = 'set -gx {var_name} {var_value}' + _VAR_FORMAT = 'set -gx {var_name} "{var_value}"' class CredentialProcessFormatter(BaseCredentialFormatter): diff --git a/tests/unit/customizations/configure/test_exportcreds.py b/tests/unit/customizations/configure/test_exportcreds.py index e131ed9f48a4..53cfa493d65b 100644 --- a/tests/unit/customizations/configure/test_exportcreds.py +++ b/tests/unit/customizations/configure/test_exportcreds.py @@ -114,14 +114,14 @@ def __eq__(self, other): FishShellFormatter, ( ( - 'set -gx AWS_ACCESS_KEY_ID access_key\n' - 'set -gx AWS_SECRET_ACCESS_KEY secret_key\n' + 'set -gx AWS_ACCESS_KEY_ID "access_key"\n' + 'set -gx AWS_SECRET_ACCESS_KEY "secret_key"\n' ), ( - 'set -gx AWS_ACCESS_KEY_ID access_key\n' - 'set -gx AWS_SECRET_ACCESS_KEY secret_key\n' - 'set -gx AWS_SESSION_TOKEN token\n' - 'set -gx AWS_CREDENTIAL_EXPIRATION 2023-01-01T00:00:00Z\n' + 'set -gx AWS_ACCESS_KEY_ID "access_key"\n' + 'set -gx AWS_SECRET_ACCESS_KEY "secret_key"\n' + 'set -gx AWS_SESSION_TOKEN "token"\n' + 'set -gx AWS_CREDENTIAL_EXPIRATION "2023-01-01T00:00:00Z"\n' ), ), ), From 3a83ed0877e3d5c4c362d655bd8ccf303d3c3427 Mon Sep 17 00:00:00 2001 From: minjcho <131win1@gmail.com> Date: Sat, 24 Jan 2026 11:51:10 +0900 Subject: [PATCH 3/3] Add changelog entry for fish shell format --- .changes/next-release/enhancement-configure-99484.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changes/next-release/enhancement-configure-99484.json diff --git a/.changes/next-release/enhancement-configure-99484.json b/.changes/next-release/enhancement-configure-99484.json new file mode 100644 index 000000000000..166d72dab470 --- /dev/null +++ b/.changes/next-release/enhancement-configure-99484.json @@ -0,0 +1,5 @@ +{ + "type": "enhancement", + "category": "configure", + "description": "Add fish shell format for export-credentials command (fixes `#9670 `__)" +}