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

Throw an exception if both lazyMultiple and multiple are set #106

Open
karfau opened this issue Jan 13, 2020 · 3 comments
Open

Throw an exception if both lazyMultiple and multiple are set #106

karfau opened this issue Jan 13, 2020 · 3 comments

Comments

@karfau
Copy link

karfau commented Jan 13, 2020

I know it's really an edge case since it can only happen when not reading the awesome documentation properly.

But since it's actually a contradiction according to the documentation and other similar things are also throwing an error, you might want to consider checking for this case and throwing an INVALID_DEFINITIONS error?

Alternatively it would make sense to just document which one wins, but if the issue is not reading docs... (hopefully this part doesn't already exist and I didn't spot it.)

@karfau
Copy link
Author

karfau commented Jan 13, 2020

When first skimming over the docs in the README, I assumed that I need to set both to have lazy, since multiple would be greedy by default.

Handling it this way, since it might be closer to the expected behaviour, could of course also be an option.

karfau added a commit to karfau/node-cli-arguments-options that referenced this issue Jan 13, 2020
…ultiple`

in aa0a3d4 I removed `multiple` from the `arr` option
I didn't expect any change, but I was wrong.

75lb/command-line-args#106
@75lb
Copy link
Owner

75lb commented Mar 10, 2020

Hi, sorry for the delay. The multiple and lazyMultiple options are mutally exclusive - you should only set one of those options, not both. Yes, setting both options should throw an exception - I'll fix that.

@75lb 75lb changed the title When configuring both lazyMultiple and multiple for an option it is greedy Throw an exception if both lazyMultiple and multiple are set May 16, 2021
@75lb 75lb assigned 75lb and unassigned 75lb Oct 16, 2021
Nerdman4U pushed a commit to Nerdman4U/command-line-args that referenced this issue Nov 10, 2023
@Nerdman4U
Copy link

Hi. I send a pull request to fix this issue. It works, there is also a simple test. Should i do something more? Im noob.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants