Issue Details (XML | Word | Printable)

Key: CLI-13
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: C Rose
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Commons CLI

[cli] CommandLine.getOptionValue() behaves contrary to docs

Created: 11/Oct/05 02:06 AM   Updated: 22/May/07 05:48 PM
Return to search
Component/s: CLI-1.x
Affects Version/s: 1.0
Fix Version/s: 1.1

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works CL13.patch 2007-05-14 12:24 PM Brian Egge 6 kB
Environment:
Operating System: Linux
Platform: PC

Bugzilla Id: 36997
Resolution Date: 22/May/07 05:48 PM


 Description  « Hide
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



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order