Here is a little background.
I kicked off TaskDaddy as a GUI app.
Then I thought, it would be nice to take the task specification on the command line as well, and using the same syntax that the GUI uses.
Then I started adding command line parameters and my custom command line parsing started to break down when I started thinking of command line option switches I wanted to add.
So I started using a third party set of functions to simplify the command line parsing. I decided to require the main argument to be in quotes so that that it would pick it up as a single argument.
So overnight the syntax changed from
taskdaddy @@Errand Go to the market
to
taskdaddy "@@Errand Go to the market"
.
But there is one problem.
What if I have this?
taskdaddy @@Someday Make another "King Kong" sequel
I'm back to multiple parameters again because I can't have double quotes within double quotes.
So one way to tackle it, is that if a parameter has a space in it, go ahead and add double quotes to the outside of it. Additionally, concatenate all the non-option parameters into one (with spaces added, of course).
There is a flaw in this, though (can you spot it?), but that was my thinking.