You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Henri Yandell (JIRA)" <ji...@apache.org> on 2006/07/12 08:06:31 UTC

[jira] Resolved: (CLI-12) [cli] Not handling property=value followed by 'remaining' args

     [ http://issues.apache.org/jira/browse/CLI-12?page=all ]
     
Henri Yandell resolved CLI-12:
------------------------------

    Resolution: Fixed

Unit test applied to 2.0

svn ci -m "Unit test created by Andrew Shirley (see CLI-12) added to show that the issue
 does not crop up in the CLI 2 API. " src/test/org/apache/commons/cli2/bug/BugCLI12Test.java 
Adding         src/test/org/apache/commons/cli2/bug/BugCLI12Test.java
Transmitting file data .
Committed revision 421150.

> [cli] Not handling property=value followed by 'remaining' args
> --------------------------------------------------------------
>
>          Key: CLI-12
>          URL: http://issues.apache.org/jira/browse/CLI-12
>      Project: Commons CLI
>         Type: Bug

>     Versions: 1.0
>  Environment: Operating System: other
> Platform: Other
>     Reporter: Jim Skufca
>      Fix For: 2.0
>  Attachments: BugCLI12Test.java, arg_pattern.patch
>
> If you have a command line args similar to
> domything -Dmyprop1=myval1 -Dmyprop2=myval2 myfile
> I would expect to be able to set up the 'D' option so that 
>  String[] opts = line.getOptionValues( "D" );
>  assertEquals( "myprop1", opts[0] );
>  assertEquals( "myval1", opts[1] );
>  assertEquals( "myprop2", opts[2] );
>  assertEquals( "myval2", opts[3] );
>  String[] xtraArgs = line.getArgs();
>  assertEquals( "myfile", xtraArgs[0]);
> But, setting up similar to the ApplicationTest.java I get 'myfile' as opts
> [4].  Since we have set up the 'D' option with hasArgs, it will only stop 
> adding args to 'D' when it runs into another valid option, not an extra arg.  
> If you set up the 'D' option with hasArg (singular) then it myprop1=myval1 
> gets reported as an invalid option.
> I've glanced at the source but didn't see an obvious fix that wouldn't 
> jeopardize the combinations and permutations that Option.addValue() must deal 
> with.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org