Skip to content

fix: do not treat option value 1 as a count increment - #548

Open
official-burak wants to merge 1 commit into
yargs:mainfrom
official-burak:fix/value-one-not-count-increment
Open

fix: do not treat option value 1 as a count increment#548
official-burak wants to merge 1 commit into
yargs:mainfrom
official-burak:fix/value-one-not-count-increment

Conversation

@official-burak

Copy link
Copy Markdown

Fixes #506.

parser("-x 3 -x 1") currently returns { x: 4 } because setKey treats any value of 1 as a count step (value === increment(), and increment() returns 1). Count flags now use a unique sentinel instead of the number 1.

-x 3 -x 1 is now [3, 1]. With duplicate-arguments-array: false the last value stays 1. Existing count tests still pass.

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.

Multiple arguments are incremented if they are equal to 1.

1 participant