commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Shirley (JIRA)" <>
Subject [jira] Commented: (CLI-13) [cli] CommandLine.getOptionValue() behaves contrary to docs
Date Tue, 06 Jun 2006 16:38:30 GMT
    [ ] 

Andrew Shirley commented on CLI-13:

moving this forward to cli2, you can use CommandLine#getValue(String) with "-d" or "--debug"
so this is fixed in cli2. I havn't looked at this problem in cli1

> [cli] CommandLine.getOptionValue() behaves contrary to docs
> -----------------------------------------------------------
>          Key: CLI-13
>          URL:
>      Project: Commons CLI
>         Type: Bug

>     Versions: 1.0 Final
>  Environment: Operating System: Linux
> Platform: PC
>     Reporter: C Rose

> Hi
> If I have:
> final String debugOpt = "debug";
> 	Option debug = OptionBuilder
> 	    .withArgName(debugOpt)
> 	    .withDescription("turn on debugging")
> 	    .withLongOpt(debugOpt)
> 	    .create('d');
> and then later I do:
> String dbg = commandLine.getOptionValue(debugOpt);
> then dbg will be null. Instead, I have to use getOptionValue('d'). This seems
> contrary to the docs (see bottom of
>, which implies that I should
> be able to query the commandLine object using a full string, rather than just
> the string's first character.
> Can I suggest that the API of OptionBuilder be made clearer so that it is
> obvious that you can have long and short option names---perhaps make the
> create() method take no arguments (thus forcing long and short arg names to be
> set explicitly). (Also, there seems to be some confusion between the terms
> 'argument' and 'option' in the API, but perhaps that is just me).
> Also, I would hop to be able to query commandLine by either a single char or an
> entire string, as suggested by the docs.
> Thanks,
> Chris

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message