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

Maximum number of arguments increase? #77

Closed
uli-objectbox opened this issue Feb 20, 2019 · 7 comments
Closed

Maximum number of arguments increase? #77

uli-objectbox opened this issue Feb 20, 2019 · 7 comments

Comments

@uli-objectbox
Copy link

Apologies if I just missed a step in setup or so, but I'm using Commander as part of Sourcery and am running out of command line arguments. It seems there is a limit of about 16 arguments in Commander.

Am I missing some script I need to run to re-generate the templated classes to be able to specify more arguments (Sourcery has many options, and I need to add some new ones)?

I couldn't find anything about this limit or avoiding it in Github issues, the Readme, nor the Wiki on Github.

@CyberDandy
Copy link

If you look at the code, there is indeed a hard limit on the arguments (14 is the maximum as of now, have a look in Commands.swift). It might be possible to improve it and make it so there is no limit by using variadic properties (or an array for what matters), but I can't affirm it.

@uli-objectbox
Copy link
Author

Yeah, the source is how I figured out there was a limit. I was just hoping there was a Sourcery Stencil or something somewhere into which I can plug a larger number and it will generate more classes. The code looked very generated.

@CyberDandy
Copy link

It is actually not possible to make it better at the moment, I am actually looking into it, and to improve it via a variadic property, we would need to be able to use arrays as variadic properties in function calls, which is not possible with Swift currently (something called Splatting). Until it becomes possible, the max limit of elements will be a hard one. Your only hope would be to propose a PR where you add more functions with more parameters, I guess... ^^'

@CyberDandy
Copy link

CyberDandy commented Feb 27, 2019

@uli-objectbox
Copy link
Author

Thank you! Figures one wouldn't expect that to be in Examples 😄

I could probably just run this in Sourcery somewhere in a shell script build phase and wouldn't even have to modify Commander itself (15 parameters are totally fine for most command line tools, after all).

@CyberDandy
Copy link

Yup, it should be :). Well, at least now that it is unearthed, the next person with the same question as you will have an easier time finding out the answer :D. Glad to have been of help ;) !

@kylef kylef closed this as completed in 6d8bad8 Jun 12, 2019
@uli-objectbox
Copy link
Author

Note: The default CocoaPod does not include the examples anymore, so if you want to run this, you need to check it out via Git in your Podfile.

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