[ 
https://issues.apache.org/jira/browse/CLI-219?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13044089#comment-13044089
 ] 

Gilles commented on CLI-219:
----------------------------

{quote}
people will most likely forget to put the quotes
{quote}
But this is a common usage for anyone used to command lines...
I think that the behaviour which I'm proposing is quite well defined, once it 
is assumed that a single argument is passed (i.e. it is obvious that forgetting 
the quotes will pass _several_ arguments).

{quote}
what if the file names also contain a space?
{quote}

Well, it's up to the application programmer to choose a regexp that's best 
suited to the case at hand.

Splitting the argument manually is possible, but it lowers the usefulness of 
CLI. Auto-splitting could be an often used feature, that would be tedious 
repeat in the application if it can be provided with the additional clause 
("splitWith") which I'm proposing.


As I explained on the ML, the syntax you recommend makes it much more tedious 
to type a command-line.

{quote}
[...] using a regexp instead of a simple char for splitting the values that 
seems a bit overkill [...]
{quote}

It's just another possibility offered to the user (of the application). For 
example, the application programmer could use {code}\\s+{code} as a separator 
regexp in order to be forgiving if the user's command-line is something like
{code}
 $ java MyApp --foo "a  b  c"
{code}

It's not much of additional code and seems not to be incompatible with the 
current behaviour.


> Allow to specify options with a single argument that will be split into 
> multiple arguments
> ------------------------------------------------------------------------------------------
>
>                 Key: CLI-219
>                 URL: https://issues.apache.org/jira/browse/CLI-219
>             Project: Commons CLI
>          Issue Type: New Feature
>          Components: CLI-1.x
>    Affects Versions: 1.2
>            Reporter: Gilles
>              Labels: features
>             Fix For: 1.3
>
>         Attachments: svn_diff.txt
>
>
> I've explained the issue in that thread:
>   http://www.mail-archive.com/[email protected]/msg06483.html
> As hinted there, a solution might be to allow that the (single) argument of 
> an "Option" (cf. "hasArg()") be split according to a user-defined regexp 
> pattern. If given a split pattern, the code would convert a single-arg 
> "Option" into a multiple-args one (where the arguments are the result of 
> splitting the single-arg string with the pattern).

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to