commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Neidhart <>
Subject Re: Commons CLI command stype
Date Mon, 28 Jan 2013 19:22:24 GMT
On 01/28/2013 06:08 PM, Eric Liu wrote:
> Hi,
>  I know the default 'Commons CLI'  command style is like ' java -jar
> ***.jar [OPTIONS]'. Can anyone tell me how to make this kind of command
> style using Commons CLI?
>  java -jar ***.jar  [COMMAND] [OPTIONS]

Well, as you already pointed out, Commons CLI currently only supports
additional (or left-over) arguments at the end like this:

java -jar ***.jar [OPTIONS] [COMMAND]

But if you know for sure that the first token will be the command, you
could strip the first argument (after making sure it is not an option),
and only provide the remaining arguments to the parser.

The help text could be manually adjusted like that:

  formatter.printHelp("myapp [COMMAND]", header, options, footer, true);

You could also create a feature request in JIRA if you like.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message