Users Pricing

forum

Home Forums Preserve argument ordering in help sections? – MindStick

Preserve argument ordering in help sections?

Barbara Jones 2095 29 Oct 2014

I have following arguments to add to CLI

-sbx

-CSWConfig

-stripInfo

-modelSources

-catchArchive

-swSupplierName

-modelsSWExchnage

but while displaying help it is showing these options in sorted order(as shown below) which I dont want, I want all the options to be in order as they are added.

-CatchArchive

-CSWConfig

-modelSources

-sbx

-stripInfo

-swSupplierName

private void print_help() {
    String CONST_STR_CLI_INFO = "ercli.exe custzip";
    HelpFormatter formatter = new HelpFormatter();
    formatter.setOptionComparator(new Comparator() {
 
        @Override
        public int compare(Object o1, Object o2) {
            Option op1=(Option) o1;
            Option op2=(Option) o2;
            return //what to do here?
        }
    });
    formatter.printHelp(CONST_STR_CLI_INFO, null, options, "", true);
}


1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md