Commons CLI
  1. Commons CLI
  2. CLI-155

Allow caller to define ordering of options in help message

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.2
    • Component/s: Help formatter
    • Labels:
      None

      Description

      It would be nice if the caller could define their own ordering of command-line options, as an alternative to alphabetical ordering. I see there's an OptionComparator class within HelpFormatter. Maybe you could add a setOptionComparator(Comparator comp) method.

      1. CLI-155.patch
        5 kB
        Henri Yandell

        Activity

        Hide
        Henri Yandell added a comment -

        Attaching patch that implements this with unit test.

        Show
        Henri Yandell added a comment - Attaching patch that implements this with unit test.
        Hide
        Henri Yandell added a comment -

        svn ci -m "Making the OptionComparator modifiable so people can change the order in which arguments are printed by the HelpFormatter - as requested in CLI-155"

        Sending src/java/org/apache/commons/cli/HelpFormatter.java
        Sending src/test/org/apache/commons/cli/HelpFormatterTest.java
        Transmitting file data ..
        Committed revision 655735.

        Show
        Henri Yandell added a comment - svn ci -m "Making the OptionComparator modifiable so people can change the order in which arguments are printed by the HelpFormatter - as requested in CLI-155 " Sending src/java/org/apache/commons/cli/HelpFormatter.java Sending src/test/org/apache/commons/cli/HelpFormatterTest.java Transmitting file data .. Committed revision 655735.

          People

          • Assignee:
            Unassigned
            Reporter:
            Mike DeLaurentis
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development