mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 14:54:15 +00:00
fix(help): Gloss over globals with flatten
When using globals, people tend to make all of the top-level arguments global and cascading them through would just bloat the output.
This commit is contained in:
parent
9e5f93d43f
commit
c9a7ef06e1
2 changed files with 3 additions and 4 deletions
|
@ -525,7 +525,7 @@ impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> {
|
|||
};
|
||||
let args = subcommand
|
||||
.get_arguments()
|
||||
.filter(|arg| should_show_arg(self.use_long, arg))
|
||||
.filter(|arg| should_show_arg(self.use_long, arg) && !arg.is_global_set())
|
||||
.collect::<Vec<_>>();
|
||||
sub_help.write_args(&args, heading, option_sort_key);
|
||||
}
|
||||
|
|
|
@ -3109,9 +3109,8 @@ Options:
|
|||
-h, --help Print help
|
||||
|
||||
parent test:
|
||||
--child <child>
|
||||
--parent <parent>
|
||||
-h, --help Print help
|
||||
--child <child>
|
||||
-h, --help Print help
|
||||
|
||||
parent help:
|
||||
[COMMAND]... Print help for the subcommand(s)
|
||||
|
|
Loading…
Reference in a new issue