Hi russel,
Thanks for your reply, much appreciated..

If I can change the date/time format to a format where it is only one
string
what will be java syntax for definign the option within my application

e.g
inal Option persistDataOption =
 OptionBuilder.withArgName("persist").hasOptionalArgs(3)
 hasArg().withDescription("Persist Data with Scheduling") 
 .create("-p");

I cant seem to get the above line correct...

I want to define an option that has
A. 3 options... name> | <Time> | <Boolean
B. 1 Mandatory ... name
C. 2 optional params Time , Boolean

Can you help me define this option correctly first, then I can move on
and
worry about the  Date/Time being 2 strings

Regards
jhon


-----Original Message-----
From: Russel Winder [mailto:[EMAIL PROTECTED] 
Sent: 29 May 2008 20:25
To: Commons Users List
Subject: Re: Common CLi Usage

* PGP Signed by an unknown key: 05/29/2008 at 09:24:30 PM 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 please

I 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
* Unknown Key
* 0x856F058D


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to