Uploaded image for project: 'Commons CLI'
  1. Commons CLI
  2. CLI-2

[cli] Wrong usage summary

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0
    • 1.1
    • CLI-1.x
    • None
    • Operating System: other
      Platform: Other

    • 37838

    Description

      The options of a OptionGroup appears twice in the usage summary as shown by the
      following example([-c]):

      usage: [-quiet] [-debug] [-ax | -c][-c] -version [-verbose]
      [-projecthelp] [-help]
      -ax ax or c
      -c ax or c

      Also a space is missing after the OptionGroup.

      I have corrected this error by modifying the file HelpFormatter.java, line up
      247. I include the modified codes for reference:

      if( group != null /&& !list.contains(group)/ ) {
      =============> changed
      if (!list.contains(group)) {
      =============> added
      // add the group to the processed list
      list.add( group );

      // get the names of the options from the OptionGroup
      Collection names = group.getNames();

      buff.append( "[" );

      // for each option in the OptionGroup
      for( Iterator iter = names.iterator(); iter.hasNext(); ) {
      buff.append( iter.next() );
      if( iter.hasNext() )

      { buff.append( " | " ); }

      }
      buff.append( "] " );
      =============> changed
      }
      // else ignore
      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            gepas@sinonet.de L.Gao
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: