commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John O'Sullivan" <john.o.sulli...@ericsson.com>
Subject Common CLi Usage
Date Thu, 29 May 2008 10:58:59 GMT
Hi

I new to using the apache commons cli I am struggling to get this
correct and would really appreciate any help.

I need to add an option to my command line (-p) with a variable number
of options like the following..

Note there are other options -a, -f, -d but I am not interested in them
for now
e.g

myApp -p [<name> | <Time> | <Boolean>] -a XXX -d xxx -f XXX

where time is of the format 'YYYY-MM-DD HH:MM:SS' 
Note 
1. There is a space between the "YYYY-MM-DD"  and the "HH:MM:SS"(does
this mean the CLI Parser will see 2 parameters )
2. The <time> and <boolean> parameters are optional.
3. The <name> parameter is mandatory when using the -p option

I am using the Commons Cli API..
I am trying to define the option as follows but this obviously isnt
correct

final Option persistDataOption =
OptionBuilder.withArgName("persist").hasOptionalArgs(3)
hasArg().withDescription("Persist Data with Scheduling")
.create(CLIOption.PERSIST_DATA.getOptionString());
where
CLIOption.PERSIST_DATA.getOptionString()) will return the "-p" option

Can someone please show me how to define this command line option
correctly please

Thanks in advance

John	

	



> ericssonl
> John O'Sullivan
> Ericsson Software Campus
> Athlone.
> Co. Westmeath
> Ireland
> *ECN 21389
> *External +353 90 6431389
> john.o.sullivan@ericsson.com
> 
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message