commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <knst.koli...@gmail.com>
Subject Re: [cli] Example using of option with two mandatory arguments
Date Sun, 27 Feb 2011 22:56:24 GMT
2011/2/26 Henrique Seganfredo <henrique.seganfredo@bcb.gov.br>:
> 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?
>

See the sources of the HelpFormatter class in CLI-1.x:  That is how it
works: it prints a single argument name only, and Option#argName field
is "arg" by default.

Neither I see support for providing separate names for the arguments.


Note, that the count of arguments in an Option can be unlimited
(Option.UNLIMITED_VALUES).


Best regards,
Konstantin Kolinko

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


Mime
View raw message