Drop arbitrary limit on splat arguments
What is the deal with a numeric limit on splat() arguments? Why not just specify unlimited by default? If anyone wants to limit it to 1 he could always optionally pass that integer. But a limit between 1 and 999 seems quite arbitrary to me.
That's a good question. I don't recall the details, so I have to look at the sources again. Is the limit causing an issue for you?
Maybe @Tieske could shed some light if he still remembers as I believe he introduced it in the first place.
Not directly an issue but it's weird and counter intuitive API behaviour.
If I do a command like:
# takes a list of items and calculates the price of each
myproject calc "item 1" "item 2" "item3"
I expect that:
cli:splat("ITEMS", "list of items for which to calculate the price")
-- and not:
-- cli:splat("ITEMS", "list of items for which to calculate the price", nil, 999)
is enough to allow a list of multiple items. If there were just one item I would not be using splat() in the first place, but rather use option.
I don't recall why, probably has to do with implementation details. First thing that comes to mind is formatting error messages.
But from a functional perspective I don't see why this could not be changed.
I studied the code, and the maximum amount is also used to determine if enough parameters have been given on the command line; with 0 options being a valid amount.
Hey @n0la, I've spent some time going over the splat argument logic and dropped the arbitrary limit of 999 and made the default behaviour to accept an unlimited number of repetitions. Since that's a breaking API change, we must do it in a major release.
Please check it out if you can so that can proceed.