-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Add fish shell format for export-credentials #9996
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v2
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds Fish shell support to the aws configure export-credentials command, allowing Fish shell users to export AWS credentials in a format compatible with their shell.
Changes:
- Added a new
FishShellFormatterclass that outputs credentials using Fish shell'sset -gxsyntax - Updated the
SUPPORTED_FORMATSdictionary to include the new Fish formatter - Added comprehensive unit tests for the Fish shell formatter covering both static and temporary credentials
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| awscli/customizations/configure/exportcreds.py | Implements FishShellFormatter class and registers it in SUPPORTED_FORMATS |
| tests/unit/customizations/configure/test_exportcreds.py | Adds test cases for FishShellFormatter with expected output formats |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 'Display credentials as Fish shell environment variables: ' | ||
| '``set -gx AWS_ACCESS_KEY_ID EXAMPLE``' | ||
| ) | ||
| _VAR_FORMAT = 'set -gx {var_name} {var_value}' |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Fish shell formatter should quote the variable value to handle credentials that may contain special characters (spaces, quotes, etc.). Similar to PowerShell's approach, the format should be 'set -gx {var_name} "{var_value}"' to ensure values with spaces or special characters are properly handled. While AWS credential values rarely contain such characters, session tokens could potentially include them, and proper quoting ensures robustness.
| _VAR_FORMAT = 'set -gx {var_name} {var_value}' | |
| _VAR_FORMAT = 'set -gx {var_name} "{var_value}"' |
| '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' |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The expected test output should include quotes around the values to match the corrected Fish shell format. The format should be 'set -gx AWS_ACCESS_KEY_ID "access_key"' instead of 'set -gx AWS_ACCESS_KEY_ID access_key' to properly handle values with special characters.
| '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_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' |
Issue: #9670
Description of changes:
This change lets Fish users apply exported credentials directly without extra conversion.
Usage:
Example output:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.