You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 1, 2022. It is now read-only.
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 running app subcommand --help.
Actual Behavior Summary
Clap apps can only output app-subcommand as the name of a subcommand when running app subcommand --help.
Comment by pksunkara Saturday Mar 14, 2020 at 14:27 GMT
Unfortunately it's not that simple. We do app._build() before parsing which kind of propagates the app binary name to subcommands and the subcommand binary name becomes this. I have been planning to look at the binary name being used in usage messages for quite a while but it's not a priority for v3.
Comment by pickfire Saturday Mar 14, 2020 at 15:04 GMT
@pksunkara But then it was marked is D: easy? I thought it seemed easy but not. T_T
Tests are here:
staticISSUE_1431:&str = "ctest-foo USAGE: ctest fooFLAGS: -h, --help Prints help information -V, --version Prints version information";#[test] ▶RunTestfnhelp_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, ctest-foo . Especially when I cannot see or copy anything correctly:
Click to expand!
...
failures:
---- help_subcommand_without_hyphen stdout ----
--> left
ctest-foo
USAGE:
ctest foo
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
--> right
ctest-foo
USAGE:
ctest foo
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
--
thread 'help_subcommand_without_hyphen' panicked at 'assertion failed: utils::compare_output(app, "ctest foo -h", ISSUE_1431, false)', tests/help.rs:1667:5
failures:
help_subcommand_without_hyphen
test result: FAILED. 59 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
Issue by chriskrycho
Monday Mar 18, 2019 at 18:49 GMT
Originally opened as clap-rs/clap#1431
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: