Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: converted to 1.6 markup

...

This wiki site is used for discussion of topics associated with the commons-cli project whose home page is http://jakartacommons.apache.org/commons/cli

News

...

CLI Release

...

Version 1.1 of the CLI library has been ported to C# and is available at http://code.lostcreations.com/browser/trunk/lib/csharp/CLI/. You can download the sources from the subversion repository with the following command:

No Format
 
svn co http://svn.lostcreations.com/code/trunk/lib/csharp/CLI/

The following changes were made to CLI while porting:

  • Java's iterator is bi-directional while .NET's enumerator is simple, and uni-directional. I created a class, BidirectionalEnumerator<T> to match the functionality present in Java.
  • Getters and setters have become property accessors. For example, instead of getWidth() and setWidth(), there is now Width { get; set; }.
  • Method names now begin with upper case.
  • Class level variables are now prefixed with "m_".
  • Interfaces now begin with upper case "I". Ex. CommandLineParser is now ICommandLineParser.
  • I've used generics where possible instead of Objects. Ex. An ArrayList of Object types intended to hold strings is now List<string>.
  • I've used Dictionary<Tk,Tv> for a hash table.
  • In Java, the method substring is defined as func(int begin, int end) where end is exclusive and the length to splice is a result of end - begin. In .NET Substring is func(int begin, int length) where length is inclusive. Instead of changing your math I instead created a static class called JavaPorts and have created the method JavaPorts.Substring( string value, int beginIndex, int endIndex ) that functions as Java's substring.

...

2.0 is currently only available via snapshot from SVN. However here is a sample application to wet your appetites. ../CLI2/SampleApplication

...

News

...

Release 2.0 - Update

We are currently working on the final touches of releasing the 2.0 release. The tasks that remain are to improve code coverage, review and complete javadoc, and complete user documentation.CLI2 has been moved to the sandbox and becomes a separate project. Contributions are welcome!

Bad 1.0 release on Ibiblio (Maven)

...

The old 1.0 jar was renamed to commons-cli-20040117.000000.jar and a correct commons-cli-1.0.jar put in place.

Resources

Articles

  • Wiki Markup
    \[http://www.devx.com/Java/Article/30117 Extend the JDK Classes with Jakarta Commons, Part III\] - Explore Jakarta Commons components that enable you to parse arguments in a command-line application, connect to various file systems at the same time, allow an application to uniformly access configurations loaded from various sources, and pool any object.
    \\

Documentation Bugs

The Usage Scenarios documentation shows the PosixParser being used for the Ant example. This won't work. Either the BasicParser or GnuParser should be used for this example.

Wiki Markup
The \[http://jakarta.apache.org/commons/cli/usage.html Usage Scenarios\] documentation gives an API usage example for the Ant *logfile* option of:

Option logfile = OptionBuilder.withArgName( "file" )BR

No Format
                                .hasArg()

BR

No Format
                                .withDescription(  "use given file for log" )

BR

No Format
                                .create( "

file" );

This should instead be:

Option logfile = OptionBuilder.withArgName( "file" )BR

No Format
                                .hasArg()

BR

No Format
                                .withDescription(  "use given file for log" )

BR

No Format
                                .create( "

logfile" );

Similarly for the find option:

Option find = OptionBuilder.withArgName( "file" )BR

No Format
                                .hasArg()

BR

No Format
                                .withDescription(  "use given file for log" )

BR

No Format
                                .create( "

find" );

The section titled "Retrieving the argument value" shows an example of accessing the getOptionValue() method of Options. This is actually a method of CommandLine.

// get c option valueBR
String countryCode =options.getOptionValue("c"); // (Wrong if options is an instance of Options)

This should instead be:

...

Articles

  • Extend the JDK Classes with Jakarta Commons, Part III - Explore Jakarta Commons components that enable you to parse arguments in a command-line application, connect to various file systems at the same time, allow an application to uniformly access configurations loaded from various sources, and pool any object.