-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add support for variadic options #1250
Add support for variadic options #1250
Conversation
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
Added README and ready for review. Fixed a few spelling mistakes as well, so some extra files touched. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
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