-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Respect display order #6142
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
Merged
Merged
Respect display order #6142
+224
−18
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
Likely won't get to this until Monday but a couple of notes
|
456552a to
3838990
Compare
epage
reviewed
Oct 10, 2025
epage
reviewed
Oct 10, 2025
cbeb0ba to
1f07ad2
Compare
epage
reviewed
Oct 20, 2025
Co-authored-by: ericgumba <[email protected]>
In clap-rs#3362 we have an issue where when we configure an arg via .display_order(int), and then generate a manpage, the synposis and options will render the order the args were provided to the App rather than the order they were configured e.g Command::new(name) arg(Arg::new("few").short('b').display_order(2)) arg(Arg::new("bar").short('a').display_order(1)) will show ... SYNOPSIS <name> [-b] [-a] ... ... OPTIONS -b -a instead of ... SYNOPSIS <name> [-a] [-b] ... ... OPTIONS -a -b and so on. This fix adds sorting in the synopsis and options functions responsible for generating the corresponding synopsis and options sections of the manpage. Co-authored-by: ericgumba <[email protected]>
1f07ad2 to
24dfa0d
Compare
|
Thanks! |
|
Glad that I could help. Note that #6072 can now be closed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is branched off #6072 and fixes #3362. The work over at #6072 seems to have stalled. With this PR, I'd like to get the feature ready and merged.
My changes (see last commit) should resolve the comments left on the original PR. Additionally, I noticed that
option_sort_keywas fully copy/pasted on the original PR. I tried to reuse the logic and ended up creatingArgOrder. Not fully sure if this is the way to go, but I think it's quite a bit better than the current state. Especially the bit with theBTreeMapwas unnecessary andpositional_sort_keywas a overly complicated way of saying "don't do anything".Maybe you would like to implement or name
ArgOrderdifferently? Also I'm not sure where I should placeArgOrderin order to be usable in both places.