I wrote my own CommandBuilder class that builds a command string. The class provides:
The following format options were also provided to allow for various preferences or requirements.
'single_dash' => FALSE, // all flags/options have single dash instead of double, normally only single letter flags have single dash. useful for some command line interfaces like java -jar ...
'option_equal' => FALSE, // add equal between option and value, --option=value
'escape' => TRUE, // wrap each value using escapeshellarg()
'newline' => FALSE, // print each part of the command on newline for readability
If this seems like a reasonable addition I will go ahead and merge into ProcessBuilder and make a pull request.
Also seems like doing something like CommandBuilder that can be passed to Process constructor is a better design since it allows people to extend the Process class and use ProcessBuilder with their class. Or perhaps split about the command building into a command builder class and allow them to be build separately with the command builder defining a __toString(). Building the command string is the hard part or the part that can benefit most from a builder, rather than setting booleans.
Although looking at Process class, everything is private...seems like should be protected.
+1 for that and i would love it as a CommandBuilder, too. I have code in preparation for this. Are you still processing it?
Closing this issue as this would complexify the component too much for no real added benefits.