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

Add optionEndsValues bool to the @Option annotation #37

Closed
wants to merge 2 commits into from

Conversation

Randgalt
Copy link

@Randgalt Randgalt commented Dec 2, 2014

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.

…able 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.
@electrum
Copy link
Member

electrum commented Dec 2, 2014

What if the option is the last one? How do you separate the extra args from positional arguments?

@Randgalt
Copy link
Author

Randgalt commented Dec 2, 2014

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.

@Randgalt
Copy link
Author

Randgalt commented Dec 3, 2014

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.

@electrum
Copy link
Member

electrum commented Dec 3, 2014

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

@electrum
Copy link
Member

electrum commented Dec 3, 2014

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

@Randgalt
Copy link
Author

Randgalt commented Dec 3, 2014

I didn't think of the multiple options. I'll check if that works currently and, if so, close this.

@dain
Copy link
Member

dain commented Dec 3, 2014

We use the multiple repeated options in Presto for session properties.

@Randgalt
Copy link
Author

Randgalt commented Dec 4, 2014

OK - that multiple option technique works. Thanks.

@Randgalt Randgalt closed this Dec 4, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants