fix(error): Don't include default-but-required arguments in usage

This commit is contained in:
Ed Page 2022-06-04 08:41:34 -05:00
parent a971346004
commit f3bc3d5eb7

View file

@ -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();