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.

Thomas


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

Reply via email to