Ajith S created YARN-5826:
-----------------------------

             Summary: HelpFormatter ordered with insertion order
                 Key: YARN-5826
                 URL: https://issues.apache.org/jira/browse/YARN-5826
             Project: Hadoop YARN
          Issue Type: Improvement
            Reporter: Ajith S
            Assignee: Ajith S
            Priority: Minor


Here is a sample help
{code}
usage: yarn node [-list [-states <States>|-all] | -status <NodeId>]

 -all               Works with -list to list all nodes.
 -list              List all running nodes. Supports optional use of
                    -states to filter nodes based on node state, all -all
                    to list all nodes.
 -states <States>   Works with -list to filter nodes based on input
                    comma-separated list of node states.
 -status <NodeId>   Prints the status report of the node.
{code}

instead, it will be better if the options were ordered
{code}

usage: yarn node [-list [-states <States>|-all] | -status <NodeId>]

 -list              List all running nodes.
 -states <States>   Works with -list to filter nodes based on input
                    comma-separated list of node states.
 -all               Works with -list to list all nodes.
 -status <NodeId>   Prints the status report of the node.
{code}

Currently the HelpFormatter provided by commons-cli-1.2 orders the options 
alphabetically while printing. Even though there is a option to add a custom 
comparator, it may be difficult. As of v1.3 we can just  do
{code}
HelpFormatter formatter = new HelpFormatter();
formatter.setOptionComparator(null);
{code}
so that sorting is skipped and the insertion order is maintained



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to