mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 14:22:34 +00:00
fix(error): Don't include default-but-required arguments in usage
This commit is contained in:
parent
a971346004
commit
f3bc3d5eb7
1 changed files with 6 additions and 0 deletions
|
@ -772,6 +772,9 @@ impl<'help, 'cmd> Parser<'help, 'cmd> {
|
|||
);
|
||||
let used: Vec<Id> = matcher
|
||||
.arg_ids()
|
||||
.filter(|arg_id| {
|
||||
matcher.check_explicit(arg_id, crate::builder::ArgPredicate::IsPresent)
|
||||
})
|
||||
.filter(|&n| {
|
||||
self.cmd
|
||||
.find(n)
|
||||
|
@ -1613,6 +1616,9 @@ impl<'help, 'cmd> Parser<'help, 'cmd> {
|
|||
let required = self.cmd.required_graph();
|
||||
let used: Vec<Id> = matcher
|
||||
.arg_ids()
|
||||
.filter(|arg_id| {
|
||||
matcher.check_explicit(arg_id, crate::builder::ArgPredicate::IsPresent)
|
||||
})
|
||||
.filter(|n| self.cmd.find(n).map_or(true, |a| !a.is_hide_set()))
|
||||
.cloned()
|
||||
.collect();
|
||||
|
|
Loading…
Reference in a new issue