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 2003/05/08 00:02:42 UTC

DO NOT REPLY [Bug 19749] New: - HelpFormatter does not handle groups properly

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

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19749

HelpFormatter does not handle groups properly

           Summary: HelpFormatter does not handle groups properly
           Product: Commons
           Version: 1.0 Final
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: CLI
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: etienne.pelletier@pegs.com


The HelpFormatter repeats Options that have previously been printed with the group.

The problem is in the else block where options not belonging to a group are
printed.  The code gets executed if it does not belong to a group -OR- if the
group has already been printed.

   if( group != null && !list.contains(group)) {
// this gets executed when a new group is found
...
} else {
  // this gets executed if the group is OR ISN'T null, and if group is in list.  
 ....
}

The else statement on line 267 should be as follows:

} else if (group == null) {
// This will make sure that options that have not been printed as part of a group
// will not get printed again.
...
}

I believe this change fixes the problem.

Also, the append on line 264 should add an extra space after the ] to make sure
that there will be a space between the ] and the next option.

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