On Thu, 2008-05-29 at 12:58 +0200, John O'Sullivan wrote:
> 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 pleaseI don't have an immediate answer for you I'm afraid. The reason for replying is to note that this looks almost, but not quite exactly, like an ISO 8601 date -- the differences are going to be very irritating I suspect. The though struck me that ISO 8601 date should be a known construct to any CLI system. Of course, Java's current date system is effectively rubbish, and JodaTime isn't yet standard. I suspect the only way forward for the moment is to quote the date string as a parameter or use the full no space ISO 8601 format (i.e. replace space with T), and then ship the string to a JodaTime function for parsing. -- Russel. ==================================================== Dr Russel Winder Partner Concertant LLP t: +44 20 7585 2200, +44 20 7193 9203 41 Buckmaster Road, f: +44 8700 516 084 London SW11 1EN, UK. m: +44 7770 465 077
signature.asc
Description: This is a digitally signed message part
