Closed Randgalt closed 9 years ago
What if the option is the last one? How do you separate the extra args from positional arguments?
It should be the same. If it's the last option it will just collate any remaining values. I'll add a test for that.
Can you let me know if you'll merge this (or something like it)? I'm counting on this behavior and will need to find an alternative otherwise.
Sorry, I'll expand on my question. Suppose you have a command like "git add" that takes positional arguments:
git add foo bar
How would this new feature interact with that? Suppose you make --junk
a vararg option:
git add --junk abc xzy foo bar
Is this treated as not having an positional arguments? I think this would need to support --
to allow positional arguments:
git add --junk abc xyz -- foo bar
Can you point to any existing UNIX tools that work this way? This seems very non-standard. A more common way of doing it is either specifying the option multiple times, or having a delimiter:
command --junk abc --junk xyz
command --junk abc,xyz
I didn't think of the multiple options. I'll check if that works currently and, if so, close this.
We use the multiple repeated options in Presto for session properties.
OK - that multiple option technique works. Thanks.
Add optionEndsValues bool to the @Option annotation to allow for variable length parameter lists. When true, this allows options with arity > 1 to end when a new option is encountered, even if the set arity hasn't been reached.