-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add Subcommand help headings #5819
base: master
Are you sure you want to change the base?
Conversation
/// [`Command::subcommand_help_heading`]: crate::Command::subcommand_help_heading() | ||
#[inline] | ||
#[must_use] | ||
pub fn next_subcommand_help_heading(mut self, heading: impl IntoResettable<Str>) -> Self { |
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.
This will also need a way to set the help heading for the current command
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.
This will likely run into name conflicts with subcommand_help_heading
. We should probably deprecate that and migrate people over to setting next_subcommand_help_heading
.
/// [`Command::subcommand_help_heading`]: crate::Command::subcommand_help_heading() | ||
#[inline] | ||
#[must_use] | ||
pub fn next_subcommand_help_heading(mut self, heading: impl IntoResettable<Str>) -> Self { |
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 derive has special handling for regular help headings, so we should probably have the same for these
/// [`Command::subcommand_help_heading`]: crate::Command::subcommand_help_heading() | ||
#[inline] | ||
#[must_use] | ||
pub fn next_subcommand_help_heading(mut self, heading: impl IntoResettable<Str>) -> Self { |
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.
Should we only have one next_help_heading
?
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.
Good question, that would make api simpler, but I'd rather have clear separation between subcommand and parameter heading
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.
Could you explain why?
Commands: | ||
help Print this message or the help of the given subcommand(s) |
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.
Before this can move forward, we need to come to a resolution on help
. The initial discussion should be on #1553. If we need to make new issues off of that, then we can migrate from there.
Group subcommands displayed in help (#1553)
This is for help only, does not affect matching.
I've done the builder part, still figuring out derive support
(ah - it works automatically by setting subcommand_help_header=Some("foo"). I'd probably should just document it somewhere).
This is done the same way grouping args works: subcommand has optional subcommand_help_heading.
If provided, it will be used to group commands visually when displaying subcommand help.
so that we can go from
Commands:
cmd1 ...
cmd2 ...
help ...
to
Commands:
help ...
Utility commands:
cmd1 ...
cmd2 ....
Nothing changes if groups aren't used. See tests for examples.
Issues:
having subcommand_heading and subcommand_help_heading may be confusing, maybe naming should change.