commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jke...@apache.org
Subject cvs commit: jakarta-commons/cli/xdocs parser.xml
Date Tue, 30 Jul 2002 23:06:22 GMT
jkeyes      2002/07/30 16:06:22

  Modified:    cli/src/java/org/apache/commons/cli Option.java
                        OptionBuilder.java Options.java
                        PatternOptionBuilder.java
               cli/src/test/org/apache/commons/cli ApplicationTest.java
                        ParseRequiredTest.java
                        PatternOptionBuilderTest.java ValuesTest.java
               cli/xdocs parser.xml
  Log:
  integrated PatternBuilder
  
  Revision  Changes    Path
  1.5       +1 -57     jakarta-commons/cli/src/java/org/apache/commons/cli/Option.java
  
  Index: Option.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/Option.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Option.java	29 Jul 2002 22:12:37 -0000	1.4
  +++ Option.java	30 Jul 2002 23:06:21 -0000	1.5
  @@ -163,7 +163,7 @@
       public Option(String opt, boolean hasArg, String description) 
       throws IllegalArgumentException
       {
  -        this(opt, null, hasArg, description, false, false);
  +        this(opt, null, hasArg, description);
       }
       
       /**
  @@ -177,68 +177,12 @@
       public Option(String opt, String longOpt, boolean hasArg, String description) 
       throws IllegalArgumentException
       {
  -        this(opt, longOpt, hasArg, description, false, false );
  -    }
  -
  -    /**
  -     * Creates an Option using the specified parameters.
  -     *
  -     * @param opt short representation of the option
  -     * @param longOpt the long representation of the option
  -     * @param hasArg specifies whether the Option takes an argument or not
  -     * @param description describes the function of the option
  -     * @param required specifies whether the option is required or not
  -     */
  -    public Option(String opt, String longOpt, boolean hasArg, String description,
  -                  boolean required ) 
  -    throws IllegalArgumentException
  -    {
  -        this(opt, longOpt, hasArg, description, required, false );
  -    }
  -
  -    /**
  -     * Creates an Option using the specified parameters.
  -     *
  -     * @param opt short representation of the option
  -     * @param longOpt the long representation of the option
  -     * @param hasArg specifies whether the Option takes an argument or not
  -     * @param description describes the function of the option
  -     * @param required specifies whether the option is required or not
  -     * @param multipleArgs specifies whether the option has multiple argument 
  -     * values
  -     */
  -    public Option(String opt, String longOpt, boolean hasArg, String description, 
  -                  boolean required, boolean multipleArgs ) 
  -    throws IllegalArgumentException
  -    {
  -        this(opt, longOpt, hasArg, description, required, multipleArgs, null );
  -    }
  -
  -    /**
  -     * Creates an Option using the specified parameters.
  -     *
  -     * @param opt short representation of the option
  -     * @param longOpt the long representation of the option
  -     * @param hasArg specifies whether the Option takes an argument or not
  -     * @param description describes the function of the option
  -     * @param required specifies whether the option is required or not
  -     * @param multipleArgs specifies whether the option has multiple argument 
  -     * values
  -     * @param type specifies the type of the option
  -     */
  -    public Option(String opt, String longOpt, boolean hasArg, String description, 
  -                  boolean required, boolean multipleArgs, Object type ) 
  -    throws IllegalArgumentException
  -    {
           validateOption( opt );
   
           this.opt          = opt;
           this.longOpt      = longOpt;
           this.hasArg       = hasArg;
           this.description  = description;
  -        this.required     = required;
  -        this.multipleArgs = multipleArgs;
  -        this.type         = type;
       }
       
       /** <p>Retrieve the name of this Option</p>
  
  
  
  1.2       +164 -0    jakarta-commons/cli/src/java/org/apache/commons/cli/OptionBuilder.java
  
  Index: OptionBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/OptionBuilder.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- OptionBuilder.java	29 Jul 2002 22:12:37 -0000	1.1
  +++ OptionBuilder.java	30 Jul 2002 23:06:21 -0000	1.2
  @@ -1,20 +1,100 @@
  +/*
  + * $Header$
  + * $Revision$
  + * $Date$
  + *
  + * ====================================================================
  + *
  + * The Apache Software License, Version 1.1
  + *
  + * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
  + * reserved.
  + *
  + * Redistribution and use in source and binary forms, with or without
  + * modification, are permitted provided that the following conditions
  + * are met:
  + *
  + * 1. Redistributions of source code must retain the above copyright
  + *    notice, this list of conditions and the following disclaimer.
  + *
  + * 2. Redistributions in binary form must reproduce the above copyright
  + *    notice, this list of conditions and the following disclaimer in
  + *    the documentation and/or other materials provided with the
  + *    distribution.
  + *
  + * 3. The end-user documentation included with the redistribution, if
  + *    any, must include the following acknowlegement:
  + *       "This product includes software developed by the
  + *        Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowlegement may appear in the software itself,
  + *    if and wherever such third-party acknowlegements normally appear.
  + *
  + * 4. The names "The Jakarta Project", "Commons", and "Apache Software
  + *    Foundation" must not be used to endorse or promote products derived
  + *    from this software without prior written permission. For written
  + *    permission, please contact apache@apache.org.
  + *
  + * 5. Products derived from this software may not be called "Apache"
  + *    nor may "Apache" appear in their names without prior written
  + *    permission of the Apache Group.
  + *
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  + * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  + * SUCH DAMAGE.
  + * ====================================================================
  + *
  + * This software consists of voluntary contributions made by many
  + * individuals on behalf of the Apache Software Foundation.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + *
  + */
  +
   package org.apache.commons.cli;
   
  +/**
  + * <p>OptionBuilder allows the user to create Options using descriptive
  + * methods.</p>
  + * <p>Details on the Builder pattern can be found at 
  + * <a href="http://">http://</a>.</p>
  + *
  + * @author John Keyes ( jbjk at mac.com )
  + * @since 1.0
  + */
   public class OptionBuilder {
   
  +    /** long option */
       private static String longopt;
  +    /** option description */
       private static String description;
  +    /** has an argument? */
       private static boolean arg;
  +    /** is required? */
       private static boolean required;
  +    /** has multiple arguments */
       private static boolean multipleArgs;
  +    /** option type */
       private static Object type;
   
  +    /** option builder instance */
       private static OptionBuilder instance = new OptionBuilder();
   
       // private constructor
       private OptionBuilder() {
       }
   
  +    /**
  +     * <p>Resets the member variables to their default values.</p>
  +     */
       private static void reset() {
           description = null;
           longopt = null;
  @@ -24,51 +104,135 @@
           multipleArgs = false;
       }
   
  +    /**
  +     * <p>The next Option created will have the following long option value.</p>
  +     *
  +     * @param longopt the long option value
  +     * @return the OptionBuilder instance
  +     */
       public static OptionBuilder withLongOpt( String longopt ) {
           instance.longopt = longopt;
           return instance;
       }
   
  +    /**
  +     * <p>The next Option created will require an argument value.</p>
  +     *
  +     * @return the OptionBuilder instance
  +     */
       public static OptionBuilder hasArg( ) {
           instance.arg = true;
           return instance;
       }
   
  +    /**
  +     * <p>The next Option created will require an argument value if
  +     * <code>hasArg</code> is true.</p>
  +     *
  +     * @param hasArg if true then the Option has an argument value
  +     * @return the OptionBuilder instance
  +     */
  +    public static OptionBuilder hasArg( boolean hasArg ) {
  +        instance.arg = hasArg;
  +        return instance;
  +    }
  +
  +    /**
  +     * <p>The next Option created will be required.</p>
  +     *
  +     * @return the OptionBuilder instance
  +     */
       public static OptionBuilder isRequired( ) {
           instance.required = true;
           return instance;
       }
   
  +    /**
  +     * <p>The next Option created will be required if <code>required</code>
  +     * is true.</p>
  +     *
  +     * @param required if true then the Option is required
  +     * @return the OptionBuilder instance
  +     */
  +    public static OptionBuilder isRequired( boolean required ) {
  +        instance.required = required;
  +        return instance;
  +    }
  +
  +    /**
  +     * <p>The next Option created can have multiple argument values.</p>
  +     *
  +     * @return the OptionBuilder instance
  +     */
       public static OptionBuilder hasMultipleArgs( ) {
           instance.multipleArgs = true;
           return instance;
       }
   
  +    /**
  +     * <p>The next Option created will have a value that will be an instance 
  +     * of <code>type</code>.</p>
  +     *
  +     * @param type the type of the Options argument value
  +     * @return the OptionBuilder instance
  +     */
       public static OptionBuilder withType( Object type ) {
           instance.type = type;
           return instance;
       }
   
  +    /**
  +     * <p>The next Option created will have the specified description</p>
  +     *
  +     * @param description a description of the Option's purpose
  +     * @return the OptionBuilder instance
  +     */
       public static OptionBuilder withDescription( String description ) {
           instance.description = description;
           return instance;
       }
   
  +    /**
  +     * <p>Create an Option using the current settings and with 
  +     * the specified Option <code>char</code>.</p>
  +     *
  +     * @param opt the character representation of the Option
  +     * @return the Option instance
  +     * @throws IllegalArgumentException if <code>opt</code> is not
  +     * a valid character.  See Option.
  +     */
       public static Option create( char opt )
       throws IllegalArgumentException
       {
           return create( String.valueOf( opt ) );
       }
   
  +    /**
  +     * <p>Create an Option using the current settings and with 
  +     * the specified Option <code>char</code>.</p>
  +     *
  +     * @param opt the <code>java.lang.String</code> representation 
  +     * of the Option
  +     * @return the Option instance
  +     * @throws IllegalArgumentException if <code>opt</code> is not
  +     * a valid character.  See Option.
  +     */
       public static Option create( String opt ) 
       throws IllegalArgumentException
       {
  +        // create the option
           Option option = new Option( opt, arg, description );
  +
  +        // set the option properties
           option.setLongOpt( longopt );
           option.setRequired( required );
           option.setMultipleArgs( multipleArgs );
           option.setType( type );
  +
  +        // reset the OptionBuilder properties
           instance.reset();
  +
  +        // return the Option instance
           return option;
       }
   }
  
  
  
  1.8       +2 -53     jakarta-commons/cli/src/java/org/apache/commons/cli/Options.java
  
  Index: Options.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/Options.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Options.java	9 Jul 2002 22:07:27 -0000	1.7
  +++ Options.java	30 Jul 2002 23:06:21 -0000	1.8
  @@ -128,7 +128,7 @@
        * @return the resulting Options instance
        */
       public Options addOption(String opt, boolean hasArg, String description) {
  -        addOption( opt, null, hasArg, description, false );
  +        addOption( opt, null, hasArg, description );
           return this;
       }
       
  @@ -142,58 +142,7 @@
        * @return the resulting Options instance
        */
       public Options addOption(String opt, String longOpt, boolean hasArg, String description)
{
  -        addOption( opt, longOpt, hasArg, description, false );        
  -        return this;
  -    }
  -
  -    /** <p>Add an option that contains a short-name and a long-name</p>
  -     * <p>It may be specified as requiring an argument.</p>
  -     *
  -     * @param opt Short single-character name of the option.
  -     * @param longOpt Long multi-character name of the option.
  -     * @param hasArg flag signally if an argument is required after this option
  -     * @param description Self-documenting description
  -     * @param required specifies if this option is required
  -     * @return the resulting Options instance
  -     */
  -    public Options addOption(String opt, String longOpt, boolean hasArg, String description,
  -                             boolean required) {
  -        addOption( new Option(opt, longOpt, hasArg, description, required) );        
  -        return this;
  -    }
  -
  -    /** <p>Add an option that contains a short-name and a long-name</p>
  -     * <p>It may be specified as requiring an argument.</p>
  -     *
  -     * @param opt Short single-character name of the option.
  -     * @param longOpt Long multi-character name of the option.
  -     * @param hasArg flag signally if an argument is required after this option
  -     * @param description Self-documenting description
  -     * @param required specifies if this option is required
  -     * @param multipleArgs specifies if this option can accept multiple argument values
  -     * @return the resulting Options instance
  -     */
  -    public Options addOption(String opt, String longOpt, boolean hasArg, String description,
  -                             boolean required, boolean multipleArgs) {
  -        addOption( new Option(opt, longOpt, hasArg, description, required, multipleArgs)
);        
  -        return this;
  -    }
  -
  -    /** <p>Add an option that contains a short-name and a long-name</p>
  -     * <p>It may be specified as requiring an argument.</p>
  -     *
  -     * @param opt Short single-character name of the option.
  -     * @param longOpt Long multi-character name of the option.
  -     * @param hasArg flag signally if an argument is required after this option
  -     * @param description Self-documenting description
  -     * @param required specifies if this option is required
  -     * @param multipleArgs specifies if this option can accept multiple argument values
  -     * @param type specifies the type for the value of the option
  -     * @return the resulting Options instance
  -     */
  -    public Options addOption(String opt, String longOpt, boolean hasArg, String description,
  -                             boolean required, boolean multipleArgs, Object type) {
  -        addOption( new Option(opt, longOpt, hasArg, description, required, multipleArgs,
type) );        
  +        addOption( new Option( opt, longOpt, hasArg, description ) );        
           return this;
       }
   
  
  
  
  1.4       +9 -3      jakarta-commons/cli/src/java/org/apache/commons/cli/PatternOptionBuilder.java
  
  Index: PatternOptionBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/PatternOptionBuilder.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PatternOptionBuilder.java	9 Jul 2002 23:12:15 -0000	1.3
  +++ PatternOptionBuilder.java	30 Jul 2002 23:06:21 -0000	1.4
  @@ -164,7 +164,7 @@
           Object type = null;
   
           Options options = new Options();
  -
  +        
           for(int i=0; i<sz; i++) {
               ch = pattern.charAt(i);
   
  @@ -173,7 +173,10 @@
               if(!isValueCode(ch)) {
                   if(opt != ' ') {
                       // we have a previous one to deal with
  -                    options.addOption("" + opt, null, (type != null), "", required, false,
type);
  +                    options.addOption( OptionBuilder.hasArg( type != null )
  +                                                    .isRequired( required )
  +                                                    .withType( type )
  +                                                    .create( opt ) );
                       required = false;
                       type = null;
                       opt = ' ';
  @@ -189,7 +192,10 @@
   
           if(opt != ' ') {
               // we have a final one to deal with
  -            options.addOption( "" + opt, null, (type != null), "", required, false, type);
  +            options.addOption( OptionBuilder.hasArg( type != null )
  +                                            .isRequired( required )
  +                                            .withType( type )
  +                                            .create( opt ) );
           }
   
           return options;
  
  
  
  1.5       +5 -1      jakarta-commons/cli/src/test/org/apache/commons/cli/ApplicationTest.java
  
  Index: ApplicationTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/test/org/apache/commons/cli/ApplicationTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ApplicationTest.java	25 Jul 2002 21:40:08 -0000	1.4
  +++ ApplicationTest.java	30 Jul 2002 23:06:21 -0000	1.5
  @@ -48,7 +48,11 @@
           options.addOption( "logger", true, "the class which is to perform the logging"
);
           options.addOption( "listener", true, "add an instance of a class as a project listener"
);
           options.addOption( "buildfile", true, "use given buildfile" );
  -        options.addOption( "D", null, true, "use value for given property", false, true
);
  +        options.addOption( OptionBuilder.withDescription( "use value for given property"
)
  +                                        .hasArg()
  +                                        .hasMultipleArgs()
  +                                        .create( 'D' ) );
  +                           //, null, true, , false, true );
           options.addOption( "find", true, "search for buildfile towards the root of the
filesystem and use it" );
   
           String[] args = new String[]{ "-buildfile", "mybuild.xml",
  
  
  
  1.4       +5 -5      jakarta-commons/cli/src/test/org/apache/commons/cli/ParseRequiredTest.java
  
  Index: ParseRequiredTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/test/org/apache/commons/cli/ParseRequiredTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ParseRequiredTest.java	4 Jul 2002 22:32:12 -0000	1.3
  +++ ParseRequiredTest.java	30 Jul 2002 23:06:21 -0000	1.4
  @@ -40,11 +40,11 @@
                          "enable-a",
                          false,
                          "turn [a] on or off")
  -            .addOption("b",
  -                       "bfile",
  -                       true,
  -                       "set the value of [b]",
  -                       true);
  +            .addOption( OptionBuilder.withLongOpt( "bfile" )
  +                                     .hasArg()
  +                                     .isRequired()
  +                                     .withDescription( "set the value of [b]" )
  +                                     .create( 'b' ) );
       }
   
       public void tearDown()
  
  
  
  1.4       +25 -18    jakarta-commons/cli/src/test/org/apache/commons/cli/PatternOptionBuilderTest.java
  
  Index: PatternOptionBuilderTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/test/org/apache/commons/cli/PatternOptionBuilderTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PatternOptionBuilderTest.java	4 Jul 2002 22:32:12 -0000	1.3
  +++ PatternOptionBuilderTest.java	30 Jul 2002 23:06:21 -0000	1.4
  @@ -23,7 +23,7 @@
   public class PatternOptionBuilderTest
   extends TestCase
   {
  -   public static void main( String[] args )
  +    public static void main( String[] args )
      {
         String[] testName = { PatternOptionBuilderTest.class.getName() };
         junit.textui.TestRunner.main(testName);
  @@ -40,25 +40,32 @@
      }
   
      public void testSimplePattern()
  -      throws Exception
      {
  -      Options options = PatternOptionBuilder.parsePattern("a:b@cde>f+n%t/");
  -      String[] args = new String[] { "-c", "-a", "foo", "-b", "java.util.Vector", "-e",
"build.xml", "-f", "java.util.Calendar", "-n", "4.5", "-t", "http://jakarta.apache.org/" };
  +       try {
  +           Options options = PatternOptionBuilder.parsePattern("a:b@cde>f+n%t/");
  +           String[] args = new String[] { "-c", "-a", "foo", "-b", "java.util.Vector",
"-e", "build.xml", "-f", "java.util.Calendar", "-n", "4.5", "-t", "http://jakarta.apache.org/"
};
         
  -      CommandLineParser parser = CommandLineParserFactory.newParser();
  -      CommandLine line = parser.parse(options,args);
  -      assertEquals("flag a", "foo", line.getOptionValue("a"));
  -      assertEquals("string flag a", "foo", line.getOptionObject("a"));
  -      assertEquals("object flag b", new java.util.Vector(), line.getOptionObject("b"));
  -      assertEquals("boolean true flag c", true, line.hasOption("c"));
  -      assertEquals("boolean false flag d", false, line.hasOption("d"));
  -      assertEquals("file flag e", new java.io.File("build.xml"), line.getOptionObject("e"));
  -      assertEquals("class flag f", java.util.Calendar.class, line.getOptionObject("f"));
  -      assertEquals("number flag n", new Float(4.5), line.getOptionObject("n"));
  -      assertEquals("url flag t", new java.net.URL("http://jakarta.apache.org/"), line.getOptionObject("t"));
  -/// DATES NOT SUPPORTED YET.
  -//      assertEquals("number flag t", new java.util.Date(1023400137276L), line.getOptionObject('z'));
  -//     input is:  "Thu Jun 06 17:48:57 EDT 2002"
  +           CommandLineParser parser = CommandLineParserFactory.newParser();
  +           CommandLine line = parser.parse(options,args);
  +           assertEquals("flag a", "foo", line.getOptionValue("a"));
  +           assertEquals("string flag a", "foo", line.getOptionObject("a"));
  +           assertEquals("object flag b", new java.util.Vector(), line.getOptionObject("b"));
  +           assertEquals("boolean true flag c", true, line.hasOption("c"));
  +           assertEquals("boolean false flag d", false, line.hasOption("d"));
  +           assertEquals("file flag e", new java.io.File("build.xml"), line.getOptionObject("e"));
  +           assertEquals("class flag f", java.util.Calendar.class, line.getOptionObject("f"));
  +           assertEquals("number flag n", new Float(4.5), line.getOptionObject("n"));
  +           assertEquals("url flag t", new java.net.URL("http://jakarta.apache.org/"), line.getOptionObject("t"));
  +           /// DATES NOT SUPPORTED YET.
  +           //      assertEquals("number flag t", new java.util.Date(1023400137276L), line.getOptionObject('z'));
  +           //     input is:  "Thu Jun 06 17:48:57 EDT 2002"
  +       }
  +       catch( ParseException exp ) {
  +           fail( exp.getMessage() );
  +       }
  +       catch( java.net.MalformedURLException exp ) {
  +           fail( exp.getMessage() );
  +       }
      }
   
   }
  
  
  
  1.4       +5 -6      jakarta-commons/cli/src/test/org/apache/commons/cli/ValuesTest.java
  
  Index: ValuesTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/test/org/apache/commons/cli/ValuesTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ValuesTest.java	4 Jul 2002 22:32:13 -0000	1.3
  +++ ValuesTest.java	30 Jul 2002 23:06:21 -0000	1.4
  @@ -57,12 +57,11 @@
                          true,
                          "set -d");
           
  -        opts.addOption("e",
  -                       "e",
  -                       true,
  -                       "set -e",
  -                       false,
  -                       true);
  +        opts.addOption( OptionBuilder.withLongOpt( "e" )
  +                                     .hasArg()
  +                                     .hasMultipleArgs()
  +                                     .withDescription( "set -e ")
  +                                     .create( 'e' ) );
   
           opts.addOption("f",
                          "f",
  
  
  
  1.2       +1 -18     jakarta-commons/cli/xdocs/parser.xml
  
  Index: parser.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/xdocs/parser.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- parser.xml	8 Jul 2002 20:22:00 -0000	1.1
  +++ parser.xml	30 Jul 2002 23:06:22 -0000	1.2
  @@ -27,29 +27,12 @@
           GnuParser</a>.  Both of these implement the <a href="apidocs/org/apache/commons/cli/CommandLineParser.html">
           CommandLineParser</a> interface.  
         </p>
  -      <p>
  -        The parser implementation is specified using the 
  -        <code>org.apache.commons.cli.parser</code> system property.  This is
set
  -        to be the <a href="apidocs/org/apache/commons/cli/PosixParser.html">PosixParser</a>
  -        by default.
  -      </p>
         <source>
   // parser is a PosixParser
   CommandLineParser parser = CommandLineParserFactory.newParser();
   
  -// configure CLI to use the GNU Parser
  -System.setProperty( "org.apache.commons.cli.parser",
  -                    "org.apache.commons.cli.GnuParser" );
  -
   // parser is a GnuParser 
  -parser = CommandLineParserFactory.newParser();
  -
  -// configure CLI to use the Posix Parser
  -System.setProperty( "org.apache.commons.cli.parser",
  -                    "org.apache.commons.cli.PosixParser" );
  -      
  -// parser is a PosixParser 
  -parser = CommandLineParserFactory.newParser();
  +parser = CommandLineParserFactory.newParser( "org.apache.commons.cli.GnuParser" );
         </source>
       </section>
       <section name="Parse the command line">
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message