commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Bourg <ebo...@apache.org>
Subject Re: [cli] Example using of option with two mandatory arguments
Date Wed, 23 Feb 2011 19:47:18 GMT
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: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>



Mime
View raw message