Hello.  I've been looking for a method to parse a command-line string into
an string-array (for use with commons CLI, Runtime.exec(), etc.)  I haven't
been able to find one in commons CLI.  So my questions are:

 

a)       Is there a method in the commons (CLI or elsewhere) that does this,
that I have missed?

b)       If not, might such a method be a welcome addition to the commons?
(because I have such a method right here, lifted from Eclipse.)

 

This need arises from a part of my application where the user can enter a
command line into a GUI text field, which needs to be able to handle
arguments with spaces via quotes, escaped quotes, etc.  I ended up using
some code lifted from Eclipse, which corresponds to what happens to the
strings entered in the Run dialog > Java application > Arguments tab before
a process is launched (since, obviously, the user-entered command-line
string needs to be converted into a string-array somehow.)  

 

 

Reply via email to