mirror of
https://github.com/clap-rs/clap
synced 2024-12-14 06:42:33 +00:00
fix(Help): subcommand help messages requested via <cmd> help <sub> now correctly match <cmd> <sub> --help
Prior to this fix, runnning `prog help subcmd` would produce: ``` subcmd USGAE: [...] ``` Notice lack of `prog-subcmd`. Whereas running `prog subcmd --help` produced: ``` prog-subcmd USGAE: [...] ``` These two forms now match the correct one (latter). Closes #539
This commit is contained in:
parent
89d208eb7b
commit
08ad1cff4f
1 changed files with 13 additions and 0 deletions
|
@ -564,6 +564,19 @@ impl<'a, 'b> Parser<'a, 'b>
|
|||
sc.clone()
|
||||
};
|
||||
sc.create_help_and_version();
|
||||
if sc.meta.bin_name != self.meta.bin_name {
|
||||
sc.meta.bin_name = Some(format!("{}{}{}",
|
||||
self.meta
|
||||
.bin_name
|
||||
.as_ref()
|
||||
.unwrap_or(&String::new()),
|
||||
if self.meta.bin_name.is_some() {
|
||||
" "
|
||||
} else {
|
||||
""
|
||||
},
|
||||
&*sc.meta.name));
|
||||
}
|
||||
return sc._help();
|
||||
}
|
||||
subcmd_name = Some(arg_os.to_str().expect(INVALID_UTF8).to_owned());
|
||||
|
|
Loading…
Reference in a new issue