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

fix(command): add SortCategories field to sort help output for categories and their respective flags #1967

Closed
wants to merge 7 commits into from

Conversation

mahadzaryab1
Copy link
Contributor

What type of PR is this?

  • bug
  • feature

What this PR does / why we need it:

  • Previously, we were sorting the categories in the help output by default. This PR provides a configurable option to sort and does not sort by default.

(REQUIRED)

Which issue(s) this PR fixes:

This PR fixes #1914

Special notes for your reviewer:

  • The help command moves to the bottom when SortCategories is set to false - is this okay?

Testing

  • Added unit tests for the help command

Release Notes

(REQUIRED)

Added a field `SortCategories` that will sort the categories and their respective flags in lexicographical order when set to true. 

@mahadzaryab1 mahadzaryab1 requested a review from a team as a code owner August 18, 2024 19:37
@mahadzaryab1 mahadzaryab1 changed the title Sort categories fix(command): add SortCategories field to sort help output for categories and their respective flags Aug 18, 2024
@dearchap
Copy link
Contributor

@mahadzaryab1 can you fix the failing tests ?

@mahadzaryab1
Copy link
Contributor Author

mahadzaryab1 commented Aug 18, 2024

@mahadzaryab1 can you fix the failing tests ?

@dearchap the tests were flaky since the flags are held in a map and so the output is not deterministic when they are sorted. It looks like we can't have deterministic tests for the non-sorting case with the current setup unless we switch to an ordered map of some sort. Do you have any thoughts on how to proceed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flags are alphabetically sorted when using categories
2 participants