commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ebo...@apache.org
Subject svn commit: r955057 - in /commons/proper/cli/trunk/src: java/org/apache/commons/cli/BasicParser.java java/org/apache/commons/cli/GnuParser.java java/org/apache/commons/cli/Parser.java java/org/apache/commons/cli/PosixParser.java site/xdoc/usage.xml
Date Tue, 15 Jun 2010 21:26:16 GMT
Author: ebourg
Date: Tue Jun 15 21:26:15 2010
New Revision: 955057

URL: http://svn.apache.org/viewvc?rev=955057&view=rev
Log:
Deprecated PosixParser, GnuParser and BasicParser in favor of DefaultParser
Updated the documentation accordingly

Modified:
    commons/proper/cli/trunk/src/java/org/apache/commons/cli/BasicParser.java
    commons/proper/cli/trunk/src/java/org/apache/commons/cli/GnuParser.java
    commons/proper/cli/trunk/src/java/org/apache/commons/cli/Parser.java
    commons/proper/cli/trunk/src/java/org/apache/commons/cli/PosixParser.java
    commons/proper/cli/trunk/src/site/xdoc/usage.xml

Modified: commons/proper/cli/trunk/src/java/org/apache/commons/cli/BasicParser.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/java/org/apache/commons/cli/BasicParser.java?rev=955057&r1=955056&r2=955057&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/java/org/apache/commons/cli/BasicParser.java (original)
+++ commons/proper/cli/trunk/src/java/org/apache/commons/cli/BasicParser.java Tue Jun 15 21:26:15
2010
@@ -23,6 +23,7 @@ package org.apache.commons.cli;
  *
  * @author John Keyes (john at integralsource.com)
  * @version $Revision$, $Date$
+ * @deprecated Use the {@link DefaultParser} instead
  */
 public class BasicParser extends Parser
 {

Modified: commons/proper/cli/trunk/src/java/org/apache/commons/cli/GnuParser.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/java/org/apache/commons/cli/GnuParser.java?rev=955057&r1=955056&r2=955057&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/java/org/apache/commons/cli/GnuParser.java (original)
+++ commons/proper/cli/trunk/src/java/org/apache/commons/cli/GnuParser.java Tue Jun 15 21:26:15
2010
@@ -26,6 +26,7 @@ import java.util.List;
  *
  * @author John Keyes (john at integralsource.com)
  * @version $Revision$, $Date$
+ * @deprecated Use the {@link DefaultParser} instead
  */
 public class GnuParser extends Parser
 {

Modified: commons/proper/cli/trunk/src/java/org/apache/commons/cli/Parser.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/java/org/apache/commons/cli/Parser.java?rev=955057&r1=955056&r2=955057&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/java/org/apache/commons/cli/Parser.java (original)
+++ commons/proper/cli/trunk/src/java/org/apache/commons/cli/Parser.java Tue Jun 15 21:26:15
2010
@@ -30,6 +30,7 @@ import java.util.Properties;
  *
  * @author John Keyes (john at integralsource.com)
  * @version $Revision$, $Date$
+ * @deprecated The two-pass parsing with the flatten method is not enough flexible to handle
complex cases
  */
 public abstract class Parser implements CommandLineParser
 {

Modified: commons/proper/cli/trunk/src/java/org/apache/commons/cli/PosixParser.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/java/org/apache/commons/cli/PosixParser.java?rev=955057&r1=955056&r2=955057&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/java/org/apache/commons/cli/PosixParser.java (original)
+++ commons/proper/cli/trunk/src/java/org/apache/commons/cli/PosixParser.java Tue Jun 15 21:26:15
2010
@@ -28,6 +28,7 @@ import java.util.List;
  *
  * @author John Keyes (john at integralsource.com)
  * @version $Revision$, $Date$
+ * @deprecated Use the {@link DefaultParser} instead
  */
 public class PosixParser extends Parser
 {

Modified: commons/proper/cli/trunk/src/site/xdoc/usage.xml
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/site/xdoc/usage.xml?rev=955057&r1=955056&r2=955057&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/site/xdoc/usage.xml (original)
+++ commons/proper/cli/trunk/src/site/xdoc/usage.xml Tue Jun 15 21:26:15 2010
@@ -69,11 +69,11 @@ options.addOption("t", false, "display c
       <subsection name="Parsing the command line arguments">
         <p>
           The <code>parse</code> methods of <code>CommandLineParser</code>
are used 
-          to parse the command line arguments.  The <code>PosixPaser</code> is
-          great when you need to handle options that are one character long,
-          like the <code>t</code> option in this example.
+          to parse the command line arguments. There may be several implementations
+          of the <code>CommandLineParser</code> interface, the recommended one
is the
+          <code>DefaultParser</code>.
         </p>
-        <source>CommandLineParser parser = new PosixParser();
+        <source>CommandLineParser parser = new DefaultParser();
 CommandLine cmd = parser.parse( options, args);</source>
         <p>
           Now we need to check if the <code>t</code> option is present.  To do
@@ -241,15 +241,13 @@ options.addOption( property );</source>
       </subsection>
       <subsection name="Create the Parser">
         <p>
-          We now need to create a <code>Parser</code>.  This will parse the command
+          We now need to create a <code>CommandLineParser</code>. This will parse
the command
           line arguments, using the rules specified by the <code>Options</code>
and
           return an instance of <a href="api-1.2/org/apache/commons/cli/CommandLine.html">CommandLine</a>.
-          This time we will use a <a href="api-1.2/org/apache/commons/cli/GnuParser.html">GnuParser</a>
-          which is able to handle options that are more than one character long.
         </p>
         <source>public static void main( String[] args ) {
     // create the parser
-    CommandLineParser parser = new GnuParser();
+    CommandLineParser parser = new DefaultParser();
     try {
         // parse the command line arguments
         CommandLine line = parser.parse( options, args );
@@ -310,10 +308,8 @@ formatter.printHelp( "ant", options );</
     <section name="ls Example">
       <p>
         One of the most widely used command line applications in the *nix world
-        is <code>ls</code>.  To parse a command line for an application like
this
-        we will use the <a href="api-1.2/org/apache/commons/cli/PosixParser.html">PosixParser</a>.
-        Due to the large number of options required for <code>ls</code> this
-        example will only cover a small proportion of the options.  The following
+        is <code>ls</code>. Due to the large number of options required for <code>ls</code>

+        this example will only cover a small proportion of the options.  The following
         is a section of the help output.
       </p>
       <source>Usage: ls [OPTION]... [FILE]...
@@ -335,7 +331,7 @@ Sort entries alphabetically if none of -
         <a href="api-1.2/org/apache/commons/cli/Options.html">Options</a> for
this example.
       </p>
       <source>// create the command line parser
-CommandLineParser parser = new PosixParser();
+CommandLineParser parser = new DefaultParser();
 
 // create the Options
 Options options = new Options();



Mime
View raw message