commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Russel Winder <>
Subject RE: Common CLi Usage
Date Sat, 31 May 2008 17:35:50 GMT

On Thu, 2008-05-29 at 22:10 +0200, John O'Sullivan wrote:
> Hi russel,
> Thanks for your reply, much appreciated..

No problem.

If you check the email histories, you'll probably spot that Commons CLI
is a bit of a hobby horse for me.  Groovy and Gant both use it but
(unfortunately) it is very broken -- 1.0 just about works, 1.1 has a
collection of great bug fixes thanks to Hen and Brian, but is
fundamentally broken :-(,  2.x got played with and then the development
team evaporated and left the whole package in limbo.
> 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

To be honest I don't think I would even try and attempt using Commons
CLI or any other CLI package to handle the parsing of the option itself.
I would use the options system to get a simple string and then process
that string with a data parser, probably JodaTime until JSR 310 becomes

So accept "-p" as a simple option with a single string parameter and
then when you find you have one drag up the data processing actions and
handle things then.

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

View raw message