I need to define a rake task that can handle any amount of arguments, pretty much like variadic functions in C++. But I could not find a way to define it within rake’s DSL.
How can I create a rake task which can handle any amount of arguments?
An example will be useful.
Thanks!
Rake as of version 0.8 cannot handle this, as mentioned in its documentation (it simply ignores any additional arguments).
However, if you can switch to using Thor, you can get this behavior. To demonstrate, create a
Thorfilewith this content:and then call it like this:
This prints the following:
(Tested using Thor 0.14.6)