mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 14:54:15 +00:00
fix(help): Hide subcommands in flattened usage
This commit is contained in:
parent
b6561983a0
commit
a9322cabf3
2 changed files with 5 additions and 4 deletions
|
@ -113,7 +113,11 @@ impl<'cmd> Usage<'cmd> {
|
|||
}
|
||||
let mut cmd = self.cmd.clone();
|
||||
cmd.build();
|
||||
for (i, sub) in cmd.get_subcommands().enumerate() {
|
||||
for (i, sub) in cmd
|
||||
.get_subcommands()
|
||||
.filter(|c| !c.is_hide_set())
|
||||
.enumerate()
|
||||
{
|
||||
if i != 0 {
|
||||
styled.trim_end();
|
||||
let _ = write!(styled, "{}", USAGE_SEP);
|
||||
|
|
|
@ -3314,7 +3314,6 @@ fn flatten_single_hidden_command() {
|
|||
parent command
|
||||
|
||||
Usage: parent [OPTIONS]
|
||||
parent child1 [OPTIONS]
|
||||
parent help [COMMAND]...
|
||||
|
||||
Options:
|
||||
|
@ -3346,7 +3345,6 @@ parent command
|
|||
Usage: parent [OPTIONS]
|
||||
parent child1 [OPTIONS]
|
||||
parent child2 [OPTIONS]
|
||||
parent child3 [OPTIONS]
|
||||
parent help [COMMAND]...
|
||||
|
||||
Options:
|
||||
|
@ -3406,7 +3404,6 @@ Usage: parent [OPTIONS]
|
|||
parent child1 grandchild3 [OPTIONS]
|
||||
parent child1 help [COMMAND]
|
||||
parent child2 [OPTIONS]
|
||||
parent child3 [OPTIONS] [COMMAND]
|
||||
parent help [COMMAND]...
|
||||
|
||||
Options:
|
||||
|
|
Loading…
Reference in a new issue