Skip to content

Handle repeated Boolean options consistently - #620

Open
JimmyLiuJia wants to merge 1 commit into
cbeust:masterfrom
JimmyLiuJia:codex/fix-repeated-boolean-option
Open

JimmyLiuJia wants to merge 1 commit into
cbeust:masterfrom
JimmyLiuJia:codex/fix-repeated-boolean-option

Conversation

@JimmyLiuJia

Copy link
Copy Markdown

Fixes #530.

Boolean options previously flipped their current value on every occurrence. Repeating a flag could therefore restore its initial value, including -y -y turning dryRun back to false.

Use the parameter's existing assigned state to handle repeated Boolean options consistently with scalar parameters: reject a repeat by default, and leave the first value in place when allowParameterOverwriting(true) is set. This applies to both implicit Boolean arity and explicit arity = 0.

Both new regressions failed against the unchanged implementation and pass with the fix. Validation: Gradle check passed on Java 21 with 340 tests, 0 failures, 0 errors, and 0 skipped. Local validation used installed Gradle 9.8.0 because the wrapper's 9.7.1 download timed out.

AI assistance was used to investigate, implement, test, and draft this PR.

This branch has not been deployed

No deployments
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.

Repetition of same Boolean argument with arity 0 negates argument's value

1 participant