You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When passing more arguments to a command than it expects, the command is executed without error, receiving only the expected arguments.
It would be nice to throw an error instead, preventing potantially wrong actions/results unforeseen by the user.
One particular case is when an argument is a name/title/label, in which the user may include spaces while forgetting quotes.
On the other hand, I wonder if it would be possible, when said argument is the last (or only) one, to optionally put everything automatically in it, kinda like the spread operator in JS (but still outputting a string) ?
Thanks
The text was updated successfully, but these errors were encountered:
It would be nice to throw an error instead, preventing potantially wrong actions/results unforeseen by the user.
You can make this an error by calling .allowExcessArguments(false).
On the other hand, I wonder if it would be possible, when said argument is the last (or only) one, to optionally put everything automatically in it, kinda like the spread operator in JS (but still outputting a string) ?
You can explicitly collect the remaining arguments by declaring the last one as variadic like `.argument('[more-args...]').
Also, all of the arguments are available using cmd.args. This includes both the declared and the excess arguments.
Hi,
When passing more arguments to a command than it expects, the command is executed without error, receiving only the expected arguments.
It would be nice to throw an error instead, preventing potantially wrong actions/results unforeseen by the user.
One particular case is when an argument is a name/title/label, in which the user may include spaces while forgetting quotes.
On the other hand, I wonder if it would be possible, when said argument is the last (or only) one, to optionally put everything automatically in it, kinda like the spread operator in JS (but still outputting a string) ?
Thanks
The text was updated successfully, but these errors were encountered: