commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLI-266) HelpFormatter#setOptionComparator(null) doesn't display the values in inserted order
Date Tue, 21 Jun 2016 20:08:57 GMT

    [ https://issues.apache.org/jira/browse/CLI-266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15342562#comment-15342562
] 

ASF GitHub Bot commented on CLI-266:
------------------------------------

GitHub user bond- opened a pull request:

    https://github.com/apache/commons-cli/pull/6

    CLI-266: HelpFormatter with comparator null now displays in the inserted order

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/bond-/commons-cli trunk

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/commons-cli/pull/6.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #6
    
----
commit bc7bba7b03ca51a43810bb2eb9c29e3028bac23c
Author: Raviteja Lokineni <bond-@users.noreply.github.com>
Date:   2016-06-21T20:06:10Z

    CLI-266: HelpFormatter#setOptionComparator(null) now displays in the inserted order

----


> 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
>              Labels: easyfix
>
> {code:java}
> OptionGroup group = new OptionGroup();
> Option h = Option.builder("h").build();
> Option s = Option.builder("s").build();
> Option b = Option.builder("b").build();
> Option t = Option.builder("t").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(1. Group, 2. Option "o") in the order of insertion but
the groups order of display 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)

Mime
View raw message