-
-
Notifications
You must be signed in to change notification settings - Fork 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
Subcommand name without hyphen in help #1431
Comments
Is there a way to disable this output alltogether? |
@CreepySkeleton If I want to do this, I just need to add a new |
Unfortunately it's not that simple. We do |
@pksunkara But then it was marked is Tests are here: static ISSUE_1431: &str = "ctest-foo
USAGE:
ctest foo
FLAGS:
-h, --help Prints help information
-V, --version Prints version information";
#[test] ▶Run Test
fn help_subcommand_without_hyphen() {
let app = App::new("ctest").subcommand(App::new("foo"));
assert!(utils::compare_output(
app,
"ctest foo -h",
ISSUE_1431,
false
));
} It took me some time to find the trailing space that fails the test, Click to expand!
|
Related to #1382 |
My question is why is I see someone commented about external subcommands. I'd be curious to see for that would look like that justifies putting the |
I think the standard of treating subcommands name is always Also, Another aspect from your comment in #1382 is:
|
So I've only played with git and docker so far. My original assumption when starting to look at commands was that Neither mentions the command name, only the usage. The usage does not use The man pages do use I'd be interested in exploring other examples and considering whether we should reduce some of the boilerplate, not just whitespace in #3096. That might also help with help2man. |
I think Git is the exception here. With most other tools, the subcommand is not "part" of the main command. Update: On my system, all the git subcommands (i.e. |
docker doesn't show the "name" but apt does show the |
On thought I had is in #1334 we are looking at allowing opting in to flattening subcommand help output, like |
Another "second" for subcommand help being a) potentially slightly more configurable and b) defaulting to non-hyphenated. I'm not sure it's user obvious. In the worst case, it could easily be interpreted as an expectation that the user should type Personally, I'd be more than happy if the title at least only ever showed the top-level app name. The actual subcommand is pretty clear from the usage section, as well as any actual help text that's been written. |
btw the fix for #1474 will allow users to specify their own display names for commands / subcommands that can be used for help. Its currently at the phase of explicit opt-in with providing an |
This will mean we won't have an awkard `.exe` in the middle on Windows This means users can have a display name for their application rather than it being dependent on the binary name it was run as This means users can manually set it to use spaces instead of dashes for separating things out. Fixes clap-rs#992 Fixes clap-rs#1474 Fixes clap-rs#1431
This will mean we won't have an awkard `.exe` in the middle on Windows This means users can have a display name for their application rather than it being dependent on the binary name it was run as This means users can manually set it to use spaces instead of dashes for separating things out. Fixes clap-rs#992 Fixes clap-rs#1474 Fixes clap-rs#1431
With #3693, we are putting it in users hands for making the display name in the help how they want it. In #3695 (reply in thread) I talk about how to programmatically generate an alternative display name |
Maintainer's notes
Rust Version
Affected Version of clap
Bug or Feature Request Summary
Add a flag which supports printing the name of an app subcommand without the hyphen instead of with a hyphen, for apps which do not use external commands.
Expected Behavior Summary
Clap apps can output
app subcommand
as the name of a subcommand when runningapp subcommand --help
.Actual Behavior Summary
Clap apps can only output
app-subcommand
as the name of a subcommand when runningapp subcommand --help
.Steps to Reproduce the issue
App::new('app').subcommand(Subcommand::with_name('subcommand'))
.Sample Code or Link to Sample Code
notion is an app where we want subcommands to print like
notion install
notnotion-install
.Debug output
Compile clap with cargo features
"debug"
such as:Debug Output
The text was updated successfully, but these errors were encountered: