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

Repeated arguments for options #37

Closed
plivesey opened this issue Nov 13, 2016 · 4 comments
Closed

Repeated arguments for options #37

plivesey opened this issue Nov 13, 2016 · 4 comments

Comments

@plivesey
Copy link

I want to do something like:

command --set x --set y --set z ARG1 ARG2

which would parse out as an array of strings for set. I don't think this is currently possible because the Options object takes a specific count and expects all the arguments to immediately follow the --set option. Is that right? Is this a good thing to add if so?

@kylef
Copy link
Owner

kylef commented Nov 13, 2016

It's not possible yet without making a ArgumentDescriptor implementation, but it wouldn't be hard to implement. In fact, I have implemented this in the past in a tool that used Commander but never merged it into Commander yet.

I'll try dig it out, it was called VaradicOption which works very similar to https://github.com/kylef/Commander/blob/master/Sources/ArgumentDescription.swift#L30.

@plivesey
Copy link
Author

Cool and thanks. For now, I'd say this is a feature request, but vaguely possible I'll contribute this in the future.

@kylef
Copy link
Owner

kylef commented Nov 27, 2016

This is now available in Commander 0.6.0.

@kylef kylef closed this as completed Nov 27, 2016
@kylef
Copy link
Owner

kylef commented Dec 5, 2016

I have implemented this in the past in a tool that used Commander but never merged it into Commander yet. I'll try dig it out

Ah, I found it: https://github.com/kylef/Curassow/blob/87e1f9bb5297cf40a5713b649fd81be7dca9662d/Sources/Curassow.swift#L19-L56

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

No branches or pull requests

2 participants