Skip to content

Commit

Permalink
fix(Help): subcommand help messages requested via <cmd> help <sub> no…
Browse files Browse the repository at this point in the history
…w 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
  • Loading branch information
kbknapp committed Jun 24, 2016
1 parent 89d208e commit 08ad1cf
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/app/parser.rs
Expand Up @@ -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());
Expand Down

0 comments on commit 08ad1cf

Please sign in to comment.