nargs-eats-options doesn't work with array options
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 519
- Forks
- 129
- Avg merge
- 1h 34m
- Merged PRs (30d)
- 1
Description
Firstly, nargs didn't consume dashed arguments since version 9.0.0. So, issue #232 was opened, and new configuration option, nargs-eats-options, was added (thanks to @bcoe).
By now, after the fix, nargs-eats-option works well with one-value options but still doesn't work with options which are considered as arrays.
For example, --foo is an array option (and nargs is set to 1):
--foo -apple --foo banana -foo cat
is not parsed correctly even with nargs-eats-option=true .
Expected result is: foo: [ '-apple', 'banana', 'cat' ].
Actual result is: foo: ['banana', 'cat' ].
And this works correct in version 8.1.0, result is foo: [ '-apple', 'banana', 'cat' ] as expected.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the parsing case --foo -apple --foo banana -foo cat with nargs-eats-options=true, then inspect the interaction between dashed nargs values and array options. Compare the result with version 8.1.0 and add regression coverage showing that foo includes -apple, banana, and cat.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100