Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(parser): Dont report missing flags as present #5908

Merged
merged 3 commits into from
Feb 11, 2025
Merged

Conversation

epage
Copy link
Member

@epage epage commented Feb 11, 2025

When we switched flags to ArgAction::SetTrue,
we overlooked updating args_present.
Because of the default value for ArgAction::SetTrue,
args_present will always report true when a flag is defined.

I went with the trivial implementation for now. We could proactively
track this but was unsure about correctness vs overhead and so I thought
I'd have those using it pay for it.

Looking over uses on github, this will fix a couple bugs but should
otherwise be unnoticeable.

Fixes #5860

When we switched flags to `ArgAction::SetTrue`,
we overlooked updating `args_present`.
Because of the default value for `ArgAction::SetTrue`,
`args_present` will always report true when a flag is defined.

I went with the trivial implementation for now.  We could proactively
track this but was unsure about correctness vs overhead and so I thought
I'd have those using it pay for it.

Looking over uses on github, this will fix a couple bugs but should
otherwise be unnoticeable.

Fixes clap-rs#5860
@epage epage merged commit 50a2b16 into clap-rs:master Feb 11, 2025
25 checks passed
@epage epage deleted the present branch February 11, 2025 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ArgMathces::args_present behaviour with ArgAction::SetTrue
1 participant