[
https://issues.apache.org/jira/browse/CLI-13?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Brian Egge updated CLI-13:
--------------------------
Attachment: CL13.patch
Implemented hashCode and equals in the Option class, so CommandLine can just
keep a set of the options. Allow for looking up option with either the short
or long option.
> [cli] CommandLine.getOptionValue() behaves contrary to docs
> -----------------------------------------------------------
>
> Key: CLI-13
> URL: https://issues.apache.org/jira/browse/CLI-13
> Project: Commons CLI
> Issue Type: Bug
> Components: CLI-1.x
> Affects Versions: 1.0
> Environment: Operating System: Linux
> Platform: PC
> Reporter: C Rose
> Fix For: 1.1
>
> Attachments: CL13.patch
>
>
> 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
> http://jakarta.apache.org/commons/cli/usage.html), 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.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]