Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 62501 invoked from network); 27 Nov 2002 04:09:02 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 27 Nov 2002 04:09:02 -0000 Received: (qmail 2024 invoked by uid 97); 27 Nov 2002 04:10:10 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 1983 invoked by uid 97); 27 Nov 2002 04:10:09 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 28009 invoked by uid 98); 27 Nov 2002 04:03:36 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) From: "Pete Kazmier" Date: Tue, 26 Nov 2002 23:02:31 -0500 To: commons-dev@jakarta.apache.org Subject: [PATCH] [CLI] Documentation Fixes Message-ID: <20021126230231.A28362@kazmier.com> Mail-Followup-To: kaz@kazmier.com, commons-dev@jakarta.apache.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="DocE+STaALJfprDB" Content-Disposition: inline User-Agent: Mutt/1.2.5.1i X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N --DocE+STaALJfprDB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline While reading the CLI documentation, I found several typos that I corrected in the attached patch. Thanks, Pete --DocE+STaALJfprDB Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="cli-doc.patch" Index: introduction.xml =================================================================== RCS file: /home/cvspublic/jakarta-commons/cli/xdocs/introduction.xml,v retrieving revision 1.4 diff -u -r1.4 introduction.xml --- introduction.xml 13 Nov 2002 00:02:31 -0000 1.4 +++ introduction.xml 27 Nov 2002 03:48:44 -0000 @@ -25,7 +25,7 @@ Options class, as a container for Option instances. There are two ways to create - Options in CLI. One of them is via the constuctors, + Options in CLI. One of them is via the constructors, the other way is via the factory methods defined in Options.

@@ -62,7 +62,7 @@

- The interrogation stage is where the application querys the + The interrogation stage is where the application queries the CommandLine to decide what execution branch to take depending on boolean options and to use the option values to provide the application data. Index: usage.xml =================================================================== RCS file: /home/cvspublic/jakarta-commons/cli/xdocs/usage.xml,v retrieving revision 1.4 diff -u -r1.4 usage.xml --- usage.xml 13 Nov 2002 00:04:13 -0000 1.4 +++ usage.xml 27 Nov 2002 03:48:44 -0000 @@ -40,10 +40,10 @@

The addOption method has three parameters. The first parameter is a java.lang.String that represents the option. - Thesecond paramter is a boolean that specifies whether the + The second parameter is a boolean that specifies whether the option requires an argument or not. In the case of a boolean option (sometimes referred to as a flag) an argument value is not present so - it false is passed. The third parameter is the description + false is passed. The third parameter is the description of the option. This description will be used in the usage text of the application.

@@ -60,9 +60,9 @@ this we will interrogate the CommandLine object. The hasOption method takes a - java.lang.String parameter and returns true if the option + java.lang.String parameter and returns true if the option represented by the java.lang.String is present, otherwise - it returns false. + it returns false.

if(cmd.hasOption("t")) { // print the date and time @@ -81,7 +81,7 @@ // add c option options.addOption("c", true, "country code");

- The second parameter is true this time. This specifies that the + The second parameter is true this time. This specifies that the c option requires an argument value. If the required option argument value is specified on the command line it is returned, otherwise null is returned. @@ -106,9 +106,9 @@

- As one of the most ubquituous Java applications - Ant it will be used - here to illustrate how to create the Options required. The following + As one of the most ubiquitous Java applications, + Ant will be used + here to illustrate how to create the Options required. The following is the help output for Ant.

ant [options] [target [target2 [target3] ...]] @@ -131,7 +131,7 @@

Lets create the boolean options for the application as they are the easiest to create. For clarity the constructors on - Option are used here. + Option are used here.

Option help = new Option( "help", "print this message" ); Option projecthelp = new Option( "projecthelp", "print project help information" ); @@ -144,7 +144,7 @@

- The argument options are created using the OptionBuilder. + The argument options are created using the OptionBuilder.

Option logfile = OptionBuilder.withArgName( "file" ) .hasArg() @@ -177,7 +177,7 @@

The last option to create is the Java property and it too is created - using the OptionBuilder. + using the OptionBuilder.

Option property = OptionBuilder.withArgName( "property=value" ) .hasArg() @@ -211,14 +211,14 @@ options.addOption( find ); options.addOption( property );

- All the preperation is now complete and we are now ready to + All the preparation is now complete and we are now ready to parse the command line arguments.

We now need to create a Parser. This will parse the command - line arguments, using the rules specified by the Options and + line arguments, using the rules specified by the Options and return an instance of CommandLine.

public static void main( String[] args ) { @@ -234,9 +234,9 @@ } }
- +

- To see if an option has been passed thehasOption + To see if an option has been passed, the hasOption method is used. The argument value can be retrieved using the getValue method.

@@ -276,7 +276,7 @@

If you also require to have a usage statement printed then calling formatter.printHelp( "ant", options, true ) - will generate a usage statment as well as the help information. + will generate a usage statement as well as the help information.

@@ -284,11 +284,11 @@

One of the most widely used command line applications in the *nix world - is ls. To parse a command line for an application like this + is ls. To parse a command line for an application like this, a different parser is required, the PosixParser. - Due to the large number of options required for ls this - example will only cover a small proportion of the options. The following + Due to the large number of options required for ls, this + example will only cover a small portion of the options. The following is a section of the help output.

Usage: ls [OPTION]... [FILE]... --DocE+STaALJfprDB Content-Type: text/plain; charset=us-ascii -- To unsubscribe, e-mail: For additional commands, e-mail: --DocE+STaALJfprDB--