75lb / command-line-args

A mature, feature-complete library to parse command-line options.
MIT License
689 stars 106 forks source link

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

Open karfau opened 4 years ago

karfau commented 4 years ago

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 commented 4 years ago

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.

75lb commented 4 years ago

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.

Nerdman4U commented 10 months ago

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.