You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2004/09/01 06:18:58 UTC

DO NOT REPLY [Bug 30979] New: - Prefix ignored with DefaultOption

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30979>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=30979

Prefix ignored with DefaultOption

           Summary: Prefix ignored with DefaultOption
           Product: Commons
           Version: 2.0 Beta 1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: CLI
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: tech@craftbits.com


I created the same Option using DefaultOption and DefaultOptionBuilder but 
they behave differently for short (and I am guessing for long as well) 
prefixes. With DefaultOptionBuilder, the preferredName for an Option 
becomes "shortPrefix" + "shortName". With DefaultOption, the preferredName 
remains the "preferredName" supplied in the constructor, when I think it 
should become "shortPrefix"/"longPrefix" + "preferredName"

For example:

DefaultOption optionName =
  new DefaultOption(
    "-",
    "--",
    false,
    "n",
    "Print greeting",
    null,
    null,
    true,
    null,
    null,
    'n');

When used on the command line, it will require "MyApplication n" instead 
of "MyApplication -n".

The same created using the builder:

DefaultOptionBuilder oBuilder = new DefaultOptionBuilder();
  Option optionName =
    oBuilder
      .withShortName("n")
      .withDescription("Print standard greeting")
      .create();

will require "MyApplication -n" and not "MyApplication n" which would be the 
expected behaviour.

--
Vikram

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