commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Keyes <j...@mac.com>
Subject Re: [CLI] Documentation problems?
Date Wed, 21 May 2003 20:20:11 GMT

On Wednesday, May 21, 2003, at 19:10 Europe/Dublin, Razvan Surdulescu 
wrote:

> There seem to be some problems in the CLI documentation:
> http://jakarta.apache.org/commons/cli/usage.html
>
> 1. In the section entitled "Parsing the command line arguments", the
> following code does not compile since Options does not have a parse()
> method:
>
> CommandLine cmd = options.parse(args);
That is a documentation problem.  It should be the parse method on
the parser that is called not the method on Options (older version).
Look for the 'Create the Parser' section in usage.html that details
this.

> 2. I am not able to have command line options of the form "-word" where
> "word" is longer than 1 letter, although the documentation seems to 
> imply
> that this should be possible via the "ANT Example".
>
> Specifically, the following snippet:
>
>         Options options = new Options();
>         options.addOption(OptionBuilder
>                 .withDescription("dynamically generate mining model 
> XML")
>                 .create("generate"));
>
>         CommandLineParser parser = new PosixParser();
>         try {
>             CommandLine line = parser.parse(options, args);
>         } catch (ParseException pe) {
>             System.err.println(pe.getMessage());
>         }
>
> fails with:
>
> Unrecognized option: -g
>
> when I execute it with:
>
> javaw.exe -classpath commons-cli-1.0.jar Test -generate
>
> From what I can tell by looking at the code, 
> PosixParser.burstToken(...)
> expects tokens that are length 1 only.
>
> I am using CLI 1.0 (downloaded it today).
You should use the GnuParser instead of the PosixParser for this so 
that too
is a documentation error.


-John K
- - - - - - - - - - - - - - - - - - - - - - -
Jakarta Commons CLI
http://jakarta.apache.org/commons/cli


Mime
View raw message