Ravi Teja created CLI-266:
-----------------------------
Summary: HelpFormatter#setOptionComparator(null) doesn't display
the values in inserted order
Key: CLI-266
URL: https://issues.apache.org/jira/browse/CLI-266
Project: Commons CLI
Issue Type: Bug
Components: CLI-1.x, Help formatter
Affects Versions: 1.3.1
Environment: Windows
Reporter: Ravi Teja
{code:java}
OptionGroup group = new OptionGroup();
Option h = Option.builder("h").build();
Option s = Option.builder("b").build();
Option b = Option.builder("b").build();
Option t = Option.builder("b").build();
group.addOption(h)
.addOption(s)
.addOption(b)
.addOption(t);
Options options = new Options();
options.addOptionGroup(group);
options.addOption(Option.builder("o").build());
HelpFormatter formatter = new HelpFormatter();
formatter.setOptionComparator(null);
formatter.printHelp("cmd", "", options, null);
{code}
This code does print the options in the order of insertion but the group is
messed up. The OptionGroup internally uses a HashMap.
If that could be replaced with a *LinkedHashMap* this issue can be solved.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)