commons-user mailing list archives

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

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

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

where time is of the format 'YYYY-MM-DD HH:MM:SS' 
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

final Option persistDataOption =
hasArg().withDescription("Persist Data with Scheduling")
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



> ericssonl
> John O'Sullivan
> Ericsson Software Campus
> Athlone.
> Co. Westmeath
> Ireland
> *ECN 21389
> *External +353 90 6431389

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