Description
It'd be very useful if users can call commands with arguments that may contain spaces (or tabs), and have them be considered a single argument. Would love to do you a PR for this!
The way I see it, the way to go is: after getting stringArgs
, iterate over it, pushing to an intermediate array, concatenating elements once an element starts with a quote mark until an element ends with a quote mark (or until the last element). I thought about incorporating all conditions into a single regular expression to do the splitting into stringArgs
with, but after some experimentatoin I couldn't find a way to do that, but even if I did, it would likely end up very ugly (i.e. not very maintainable).
There is the question of which quote marks should be considered delimiters. Considering that this is for Discord, I'd argue that it makes sense to count backticks and triple-backticks along with the obvious double quotes. Thoughts?
I'd use this list as checklist for implementing this functionality, as it seems general enough.
PS: shouldn't arguments be split on both spaces and tabs?