Skip to content
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

Sort list output by account alias #466

Closed
braun1928 opened this issue Feb 28, 2023 · 3 comments · Fixed by #496
Closed

Sort list output by account alias #466

braun1928 opened this issue Feb 28, 2023 · 3 comments · Fixed by #496
Labels
enhancement New feature or request
Milestone

Comments

@braun1928
Copy link

Is your feature request related to a problem? Please describe.
The browser shows the accounts sorted by AccountName, which is useful when we have <team/app account>-<environment> pattern. Unfortunately the aws-sso-cli sorts by AccountNumber, making accounts separate from each other when listing, making a bit difficult to find.

Describe the solution you'd like
An option to sort the list output by other values, like AccountAlias, which can be also defined as default in the configuration file.

Describe alternatives you've considered
I know I can use grep or Command + F, or change the output fields and | sort, but it would be nice not using it, and most likely, faster.

@braun1928 braun1928 added the enhancement New feature or request label Feb 28, 2023
@synfinatic
Copy link
Owner

Are you okay with sorting by the first column? You can always override/select the fields and their order on the CLI or via the config file

@synfinatic
Copy link
Owner

Also, thoughts on how to sort when dealing with different cases? Basically is a equivalent to A or does it come after Z?

@braun1928
Copy link
Author

Are you okay with sorting by the first column? You can always override/select the fields and their order on the CLI or via the config file

Yeah, that's what I was started doing -- still need to remember to | sort the output, and ignore the header line that stays in the middle of the output.

Also, thoughts on how to sort when dealing with different cases? Basically is a equivalent to A or does it come after Z?

I'm fine with either -- sort.Strings() differentiates the case, AWS SSO main page ignores case. In my case, majority of the accounts are all lower case, so doesn't matter that much.


I saw a minor thing: the account number is parsing to a number, so drops the leading 0. Not a huge deal, but caught my eye.

@synfinatic synfinatic added this to the next release milestone May 4, 2023
synfinatic added a commit that referenced this issue Jul 30, 2023
Add `--sort` and `--reverse` to the `list` command to enable
sorting by any available field and reverse sorting.  Sorting
always happens alphabetically and is case-sensitive.

AccountIds are also now always presented with leading zeros
as appropriate now.

Fixes #466
synfinatic added a commit that referenced this issue Jul 30, 2023
Add `--sort` and `--reverse` to the `list` command to enable
sorting by any available field and reverse sorting.  Sorting
always happens alphabetically and is case-sensitive.

AccountIds are also now always presented with leading zeros
as appropriate now.

Improve unit tests for AccountId's with a leading zero

Fixes #466
synfinatic added a commit that referenced this issue Jul 30, 2023
Add `--sort` and `--reverse` to the `list` command to enable
sorting by any available field and reverse sorting.  Sorting
always happens alphabetically and is case-sensitive.

AccountIds are also now always presented with leading zeros
as appropriate now.

Improve unit tests for AccountId's with a leading zero

Fixes #466
synfinatic added a commit that referenced this issue Jul 30, 2023
Add `--sort` and `--reverse` to the `list` command to enable
sorting by any available field and reverse sorting.  Sorting
always happens alphabetically and is case-sensitive.

AccountIds are also now always presented with leading zeros
as appropriate now.

Improve unit tests for AccountId's with a leading zero

Fixes #466
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants