-
Notifications
You must be signed in to change notification settings - Fork 86
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
Comments
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. |
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. |
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... ^^' |
Hey @uli-objectbox , I think found what you were looking for, actually... https://github.com/kylef/Commander/blob/master/Examples/generator-template.swift You can use this script to regenerate it: https://github.com/kylef/Commander/blob/master/Examples/generator.swift |
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). |
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 ;) ! |
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. |
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.
The text was updated successfully, but these errors were encountered: