You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When parsing unknown flags into a struct that has ignore_errors(true), clap fails with "The following required argument was not provided: bar" upon encountering an unrecognized flag, whereas bar is a bool flag that should default to false.
I added an example with an unknown arg first, assuming it should step over the unknown arg and still set bar to true based on --bar presence. Not sure if that's possible at all, given that we just discussed positional args vs --bar possibly being a value to the --foo flag...
Looks like this ends up being a duplicate of #4391, after GH title search (when creating issues) is more helpful than a search for keywords on its own.
EDIT: Or not, since it seems to work correctly for me when not passing --bar, and specifically requires an ignored unknown arg first...
When parsing unknown flags into a struct that has
ignore_errors(true)
,clap
fails with"The following required argument was not provided: bar"
upon encountering an unrecognized flag, whereasbar
is abool
flag that should default tofalse
.Repro
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=c8526876b56fbc51bb2a8e2440be52c1
Bonus
I added an example with an unknown arg first, assuming it should step over the unknown arg and still set
bar
to true based on--bar
presence. Not sure if that's possible at all, given that we just discussed positional args vs--bar
possibly being a value to the--foo
flag...Originally posted by @MarijnS95 in #1404 (comment)
The text was updated successfully, but these errors were encountered: