Add support for variadic options#1250
Merged
shadowspawn merged 13 commits intotj:release/6.xfrom Jun 1, 2020
Merged
Conversation
Collaborator
Author
|
Using variadic options will cause some complications for caller to clarify their intent under some circumstances, in similar ways to options with optional values. So I don't want to promote it too much, it should only be used when compelling benefits. I am thinking it will be mentioned briefly in the README with a longer explanation in a separate document. |
- remove ellipsis for symmetry with .arguments - require word character before dots
Collaborator
Author
|
Added README and ready for review. Fixed a few spelling mistakes as well, so some extra files touched. |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Problem
People would like to be able to use variadic options, an option which can take more than one value from the following arguments.
See #571
Solution
Being cautious, this makes the change a breaking change in case people have put dots after a comma separated list for example.
If a value or values are specified then the option value is an array.
The first option argument is parsed in the same way as if the
...was not specified.Subsequent option arguments are processed as for optional options (
[value]), so a leading-or--indicates an option and not a further argument. A lone--stops the option processing as normal.The variadic behaviour triggers for stand-alone options with the first value in the next argument, and not for options where the option value is included in the argument.
These do not trigger variadic processing:
These are equivalent:
Example:
ChangeLog