Hello Emmanuel,
I´ve been trying to to this:
Option db1topkds = OptionBuilder
.hasArgs(5)
.create("db1topkds");
When I execute the app without any option, help is displayed like this:
MyApp v.1.0 (c) 2011
usage: MyApp
-db1topkds <arg>
Why is not showing something like
usage: MyApp
-db1topkds <arg1> <arg2> <arg3> <arg4> <arg5>
??
Any idea? Isn´t this the expected behavior? I am confused, does Commons-CLI
supports or not multiple arguments for an option?
Regards,
-----Mensagem original-----
De: Emmanuel Bourg [mailto:[email protected]]
Enviada em: quarta-feira, 23 de fevereiro de 2011 16:47
Para: Commons Users List
Assunto: Re: [cli] Example using of option with two mandatory arguments
Hi Henrique,
With CLI 1.x you would do it like this :
Options options = new Options();
options.addOption(OptionBuilder.hasArgs(2).create("myoption"));
CommandLine cmd = new DefaultParser().parse(options, new String[] {
"-myoption", "argument1" });
If an argument is missing a MissingArgumentException is thrown.
Emmanuel Bourg
Le 23/02/2011 19:46, Henrique Seganfredo a écrit :
> Hello,
>
> Could please someone post an example of Commons CLI to have na option with
> two mandatory arguments?
>
> Example:
>
> ./myprog -myoption<argument1> <argument2>
>
> Many thanks,
>
> Henrique Seganfredo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]