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/src/test/org/apache/commons/cli AnonymousArgumentTest.java ApplicationTest.java BugzillaTest.java ChildOptionTest.java CommandLineParserTest.java GnuParseTest.java OptionGroupTest.java OptionsTest.java ParseRequiredTest.java ParseTest.java ValueTest.java ValueTypeTest.java
Date Tue, 20 May 2003 23:08:55 GMT
jkeyes      2003/05/20 16:08:55

  Modified:    cli/src/java/org/apache/commons/cli Tag: cli_1_x
                        ArgumentBuilder.java OptionBuilder.java
               cli/src/test/org/apache/commons/cli Tag: cli_1_x
                        AnonymousArgumentTest.java ApplicationTest.java
                        BugzillaTest.java ChildOptionTest.java
                        CommandLineParserTest.java GnuParseTest.java
                        OptionGroupTest.java OptionsTest.java
                        ParseRequiredTest.java ParseTest.java
                        ValueTest.java ValueTypeTest.java
  Log:
  modified isRequired to be withRequired on the builders, also added withName and withLongName
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +16 -6     jakarta-commons/cli/src/java/org/apache/commons/cli/Attic/ArgumentBuilder.java
  
  Index: ArgumentBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/Attic/ArgumentBuilder.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- ArgumentBuilder.java	19 May 2003 20:57:51 -0000	1.1.2.1
  +++ ArgumentBuilder.java	20 May 2003 23:08:54 -0000	1.1.2.2
  @@ -16,19 +16,29 @@
       private Class type;
       private boolean hasOptionalValues;
   
  -    public Argument create( final String name ) {
  +    /*public Argument create( final String name ) {
           return create( name, null );
  -    }
  +    }*/
   
  -    public Argument create( final String name, final String longName ) {
  +    public Argument create() {
           try {
  -            return new ArgumentImpl( name, longName, this.description, this.required, this.size,
this.type, this.valueSeparator, this.valueName, this.hasOptionalValues, this.children );
  +            return new ArgumentImpl( this.name, this.longName, this.description, this.required,
this.size, this.type, this.valueSeparator, this.valueName, this.hasOptionalValues, this.children
);
           }
           finally {
               reset();
           }
       }
       
  +    public ArgumentBuilder withName( final String name ) {
  +    	this.name = name;
  +    	return this;
  +    }
  +
  +	public ArgumentBuilder withLongName( final String longName ) {
  +		this.longName = longName;
  +		return this;
  +	}
  +    
       public Argument createAnonymous( final String name ) {
       	return new AnonymousArgumentImpl( name );
       }
  @@ -42,8 +52,8 @@
           return this;
       }
   
  -    public ArgumentBuilder isRequired() {
  -        this.required = true;
  +    public ArgumentBuilder withRequired(boolean required) {
  +        this.required = required;
           return this;
       }
   
  
  
  
  1.15.2.2  +16 -6     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.15.2.1
  retrieving revision 1.15.2.2
  diff -u -r1.15.2.1 -r1.15.2.2
  --- OptionBuilder.java	19 May 2003 20:59:44 -0000	1.15.2.1
  +++ OptionBuilder.java	20 May 2003 23:08:54 -0000	1.15.2.2
  @@ -15,27 +15,37 @@
   		return new OptionBuilder();
   	}
   	
  -    public Option create( final String name ) {
  +    /*public Option create( final String name ) {
           return create( name, null );
  -    }
  +    }*/
   
  -    public Option create( final String name, final String longName ) {
  +    public Option create() {// final String name, final String longName ) {
           try {
  -            return new OptionImpl( name, longName, this.description, this.required, this.children
);
  +            return new OptionImpl( this.name, this.longName, this.description, this.required,
this.children );
           }
           finally {
               reset();
           }
       }
   
  +	public OptionBuilder withName (String name) {
  +		this.name = name;
  +		return this;
  +	}
  +	
  +	public OptionBuilder withLongName (String longName) {
  +		this.longName = longName;
  +		return this;
  +	}
  +	
       public OptionBuilder withDescription( String description ) {
           this.description = description;
           return this;
       }
   
   
  -    public OptionBuilder isRequired() {
  -        this.required = true;
  +    public OptionBuilder withRequired(boolean required) {
  +        this.required = required;
           return this;
       }
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +3 -3      jakarta-commons/cli/src/test/org/apache/commons/cli/Attic/AnonymousArgumentTest.java
  
  Index: AnonymousArgumentTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/test/org/apache/commons/cli/Attic/AnonymousArgumentTest.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- AnonymousArgumentTest.java	19 May 2003 20:47:50 -0000	1.1.2.1
  +++ AnonymousArgumentTest.java	20 May 2003 23:08:54 -0000	1.1.2.2
  @@ -48,7 +48,7 @@
   		Options options = new Options();
   		
   		Argument anon = abuilder.createAnonymous( "token" );
  -		Option opt = obuilder.create("f");
  +		Option opt = obuilder.withName("f").create();
   		
   		options.add( anon );
   		options.add( opt );
  @@ -69,7 +69,7 @@
   		Options options = new Options();
   		
   		Argument anon = abuilder.createAnonymous( "token" );
  -		Argument file = abuilder.create("f");
  +		Argument file = abuilder.withName("f").create();
   		
   		options.add( anon );
   		options.add( file );
  @@ -135,7 +135,7 @@
   		}
   		
   		OptionBuilder obuilder = new OptionBuilder();
  -		Option f = obuilder.create("f");
  +		Option f = obuilder.withName("f").create();
   		try {
   			anon.addChild(f);
   			fail("expected exception not caught");
  
  
  
  1.9.2.2   +30 -32    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.9.2.1
  retrieving revision 1.9.2.2
  diff -u -r1.9.2.1 -r1.9.2.2
  --- ApplicationTest.java	19 May 2003 20:50:23 -0000	1.9.2.1
  +++ ApplicationTest.java	20 May 2003 23:08:54 -0000	1.9.2.2
  @@ -46,46 +46,44 @@
   		ArgumentBuilder abuilder = new ArgumentBuilder();
   		Option a =
   			obuilder.withDescription(
  -				"do not hide entries starting with .").create(
  -				"a",
  -				"all");
  +				"do not hide entries starting with .").withName(
  +				"a").withLongName(
  +				"all").create();
   		options.add(a);
   
   		Option A =
  -			obuilder.withDescription("do not list implied . and ..").create(
  -				"A",
  -				"almost-all");
  +			obuilder.withDescription("do not list implied . and ..").withName(
  +				"A").withLongName(
  +				"almost-all").create();
   		options.add(A);
   
   		Option b =
   			obuilder
   				.withDescription("print octal escapes for nongraphic characters")
  -				.create("b", "escape");
  +				.withName("b").withLongName("escape").create();
   		options.add(b);
   
   		Argument blockSize =
   			abuilder.withDescription(
   				"use SIZE-byte blocks").withValueSeparator(
  -				'=').create(
  -				null,
  -				"block-size");
  +				'=').withLongName("block-size").create();
   		options.add(blockSize);
   
   		Option B =
   			obuilder.withDescription(
  -				"do not list implied entried ending with ~").create(
  -				"B",
  -				"ignore-backups");
  +				"do not list implied entried ending with ~").withName(
  +				"B").withLongName(
  +				"ignore-backups").create();
   		options.add(B);
   
   		Option c =
   			obuilder
   				.withDescription("with -lt: sort by, and show, ctime (time of last modification of
file status information) with -l:show ctime and sort by name otherwise: sort by ctime")
  -				.create("c");
  +				.withName("c").create();
   		options.add(c);
   
   		Option C =
  -			obuilder.withDescription("list entries by columns").create("C");
  +			obuilder.withDescription("list entries by columns").withName("C").create();
   		options.add(C);
   
   		String[] args = new String[] { "--block-size=10" };
  @@ -106,48 +104,48 @@
   		ArgumentBuilder abuilder = new ArgumentBuilder();
   
   		Option help =
  -			obuilder.withDescription("print this message").create("help");
  +			obuilder.withDescription("print this message").withName("help").create();
   		options.add(help);
   		Option projecthelp =
  -			obuilder.withDescription("print project help information").create(
  -				"projecthelp");
  +			obuilder.withDescription("print project help information").withName(
  +				"projecthelp").create();
   		options.add(projecthelp);
   		Option version =
   			obuilder.withDescription(
  -				"print the version information and exit").create(
  -				"version");
  +				"print the version information and exit").withName(
  +				"version").create();
   		options.add(version);
   		Option quiet =
  -			obuilder.withDescription("be extra quiet").create("quiet");
  +			obuilder.withDescription("be extra quiet").withName("quiet").create();
   		options.add(quiet);
   		Option verbose =
  -			obuilder.withDescription("be extra verbose").create("verbose");
  +			obuilder.withDescription("be extra verbose").withName("verbose").create();
   		options.add(verbose);
   		Option debug =
  -			obuilder.withDescription("print debug information").create("debug");
  +			obuilder.withDescription("print debug information").withName("debug").create();
   		options.add(debug);
   
   		Argument logfile =
  -			abuilder.withDescription("use given file for log").create(
  -				"logfile");
  +			abuilder.withDescription("use given file for log").withName(
  +				"logfile").create();
   		options.add(logfile);
   		Argument logger =
   			abuilder.withDescription(
  -				"the class which is to perform the logging").create(
  -				"logger");
  +				"the class which is to perform the logging").withName(
  +				"logger").create();
   		options.add(logger);
   		Argument listener =
   			abuilder
   				.withDescription("add an instance of a class as a project listener")
  -				.create("listener");
  +				.withName("listener").create();
   		options.add(listener);
   		Argument buildfile =
  -			abuilder.withDescription("use given buildfile").create("buildfile");
  +			abuilder.withDescription("use given buildfile").withName("buildfile").create();
   		options.add(buildfile);
   		Argument find =
   			abuilder
   				.withDescription("search for buildfile towards the root of the filesystem and use it")
  -				.create("find");
  +				.withName("find").create();
   		options.add(find);
   
   		String[] args =
  @@ -178,12 +176,12 @@
   		ArgumentBuilder abuilder = new ArgumentBuilder();
   		
   		Option q = obuilder.withDescription("Cause CVS to be somewhat quiet.")
  -		    .create("q");
  +		    .withName("q").create();
   		
   		Argument anon = abuilder.createAnonymous("command");
   		    
   		Option p = obuilder.withDescription("Prune empty directories.")
  -		    .create("p");
  +		    .withName("p").create();
   		Set opts = new HashSet();
   		opts.add(p);
   
  
  
  
  1.1.2.2   +22 -23    jakarta-commons/cli/src/test/org/apache/commons/cli/Attic/BugzillaTest.java
  
  Index: BugzillaTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/test/org/apache/commons/cli/Attic/BugzillaTest.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- BugzillaTest.java	19 May 2003 20:47:50 -0000	1.1.2.1
  +++ BugzillaTest.java	20 May 2003 23:08:54 -0000	1.1.2.2
  @@ -22,7 +22,7 @@
           Options opts = new Options();
           OptionBuilder builder = OptionBuilder.createBuilder();
           
  -        opts.add(builder.create( null, "verbose" ));
  +        opts.add(builder.withLongName("verbose" ).create());
   
           CommandLineParser parser = new CommandLineParser();
   
  @@ -36,7 +36,7 @@
   
   		Options options = new Options();
   
  -		Option p = builder.withValueSeparator(':').withSize(100).create("p");
  +		Option p = builder.withValueSeparator(':').withSize(100).withName("p").create();
   		options.add( p );
   		
   		String[] args =
  @@ -78,14 +78,13 @@
   		OptionBuilder builder = new OptionBuilder();
   		
   		Option left = builder.withDescription("go left")
  -							 .create("l", "left");
  +							 .withName("l").withLongName("left").create();
   		Option right = builder.withDescription("go right")
  -							 .create("r", "right");
  +					         .withName("r").withLongName("right").create();
   		Option straight = builder.withDescription("go straight")
  -							 .create("s", "straight");
  +  	                         .withName("s").withLongName("straight").create();
   		Option forward = builder.withDescription("go forward")
  -		                     .isRequired()
  -							 .create("f", "forward");
  +                             .withRequired(true).withName("f").withLongName("forward").create();
   		                      
   		//Option left = new Option( "l", "left", false, "go left" );
   		//Option right = new Option( "r", "right", false, "go right" );
  @@ -155,25 +154,25 @@
   		Set execOptions = new HashSet();
   		
   		execOptions.add(builder.withDescription("desc")
  -							   .create("exec_opt1"));
  +							   .withName("exec_opt1").create());
   		execOptions.add(builder.withDescription("desc")
  -							   .create("exec_opt2"));
  +							   .withName("exec_opt2").create());
   		                       
   		// similarly, for rep there are 2 options...
   		Set repOptions = new HashSet();
   		repOptions.add(builder.withDescription("desc")
  -							   .create("repopto"));
  +							   .withName("repopto").create());
   		repOptions.add(builder.withDescription("desc")
  -							   .create("repoptt"));
  +							   .withName("repoptt").create());
   
   		ExclusiveOptionGroup grp = new ExclusiveOptionGroup();
   		grp.add(builder.withDescription("description for this option")
   		               .withChildren(execOptions)
  -					   .create("exec"));
  +					   .withName("exec").create());
   
   		grp.add(builder.withDescription("description for this option")
                          .withChildren(repOptions)
  -					   .create("rep"));
  +					   .withName("rep").create());
   
   		mainOptions.add(grp);
   
  @@ -199,8 +198,8 @@
           Options options = new Options();
           ArgumentBuilder builder = ArgumentBuilder.createBuilder();
           
  -        options.add(builder.create("f", "foobar"));
  -		options.add(builder.create("m", "missing"));
  +        options.add(builder.withName("f").withLongName("foobar").create());
  +		options.add(builder.withName("m").withLongName("missing").create());
           String[] args = new String[] { "-f" , "foo" };
   
           CommandLineParser parser = new CommandLineParser();
  @@ -221,8 +220,8 @@
   		ArgumentBuilder builder = ArgumentBuilder.createBuilder();
   		
           Options opts = new Options();
  -        opts.add(builder.create( "o", "old-password" ));
  -        opts.add(builder.create( "c", "new-password" ));
  +        opts.add(builder.withName( "o").withLongName("old-password" ).create());
  +        opts.add(builder.withName( "c").withLongName( "new-password" ).create());
   
           CommandLineParser parser = new CommandLineParser();
   
  @@ -238,7 +237,7 @@
   
       public void test14786() throws Exception {
   		OptionBuilder builder = OptionBuilder.createBuilder();
  -		Option o = builder.isRequired().create("test");
  +		Option o = builder.withRequired(true).withName("test").create();
           Options opts = new Options();
           opts.add(o);
           opts.add(o);
  @@ -257,7 +256,7 @@
           
           ArgumentBuilder builder = ArgumentBuilder.createBuilder();
           
  -        Option m = builder.create("m");
  +        Option m = builder.withName("m").create();
           Options options = new Options();
           options.add( m );
           CommandLine cmdline = parser.parse( options, args );
  @@ -271,7 +270,7 @@
   		ArgumentBuilder builder = new ArgumentBuilder();
   		
   		Argument option = builder.withDescription("affected option")
  -		                       .create("z", "timezone"); 
  +		                       .withName("z").withLongName("timezone").create(); 
   		//new Option("z", "timezone", true, 
   		//						   "affected option");
   		Options cliOptions = new Options();
  @@ -279,7 +278,7 @@
   		
   		//now add conflicting option
   		Argument conflicting = builder.withDescription("conflicting option")
  -		                             .create("c", "conflict");
  +		                             .withName("c").withLongName("conflict").create();
   		cliOptions.add( conflicting );
   		//Option("c", "conflict", true, "conflict option");
   		CommandLine line = parser.parse(cliOptions, CLI_ARGS);
  @@ -292,10 +291,10 @@
   		Options options = new Options();
   		
   		ArgumentBuilder builder = new ArgumentBuilder();
  -		Option a = builder.hasOptionalValues().create("a");
  +		Option a = builder.hasOptionalValues().withName("a").create();
   		//options.addOption( OptionBuilder.hasOptionalArg()
   		//				   .create( 'a' ) );
  -		Option b = builder.create("b");
  +		Option b = builder.withName("b").create();
   		//options.addOption( OptionBuilder.hasArg()
   		//				   .create( 'b' ) );
   		options.add(a);
  
  
  
  1.1.2.2   +4 -4      jakarta-commons/cli/src/test/org/apache/commons/cli/Attic/ChildOptionTest.java
  
  Index: ChildOptionTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/test/org/apache/commons/cli/Attic/ChildOptionTest.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- ChildOptionTest.java	19 May 2003 20:47:50 -0000	1.1.2.1
  +++ ChildOptionTest.java	20 May 2003 23:08:54 -0000	1.1.2.2
  @@ -30,9 +30,9 @@
   	public void testChildOption() throws Exception {
   		OptionBuilder builder = OptionBuilder.createBuilder();
   		
  -		Option parent = builder.create("p");
  +		Option parent = builder.withName("p").create();
   		
  -		Option child = builder.create("c");
  +		Option child = builder.withName("c").create();
   		
   		parent.addChild(child);
   		
  @@ -61,9 +61,9 @@
   		OptionBuilder builder = OptionBuilder.createBuilder();
   		ArgumentBuilder abuilder = ArgumentBuilder.createBuilder();
   		
  -		Option parent = builder.create("p");
  +		Option parent = builder.withName("p").create();
   		
  -		Argument child = abuilder.create("c");
  +		Argument child = abuilder.withName("c").create();
   		
   		parent.addChild(child);
   		
  
  
  
  1.1.2.2   +7 -7      jakarta-commons/cli/src/test/org/apache/commons/cli/Attic/CommandLineParserTest.java
  
  Index: CommandLineParserTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/test/org/apache/commons/cli/Attic/CommandLineParserTest.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- CommandLineParserTest.java	19 May 2003 20:47:50 -0000	1.1.2.1
  +++ CommandLineParserTest.java	20 May 2003 23:08:54 -0000	1.1.2.2
  @@ -215,8 +215,8 @@
       public void testMandatory() throws Exception {
   		OptionBuilder builder = OptionBuilder.createBuilder();
   
  -        Option single = builder.isRequired().create("single");
  -        Option doubla = builder.isRequired().create("double", "dalias");
  +        Option single = builder.withRequired(true).withName("single").create();
  +        Option doubla = builder.withRequired(true).withName("double").withLongName("dalias").create();
           Options opts = new Options();
           opts.add( single );
           opts.add( doubla );
  @@ -252,9 +252,9 @@
       public void testOptionGroup() throws Exception {
   		OptionBuilder builder = OptionBuilder.createBuilder();
   
  -        Option create = builder.create("c");
  -        Option test = builder.create("t");
  -        Option jar = builder.create("j");
  +        Option create = builder.withName("c").create();
  +        Option test = builder.withName("t").create();
  +        Option jar = builder.withName("j").create();
           
           ExclusiveOptionGroup func = new ExclusiveOptionGroup();
           func.add( create );
  @@ -294,7 +294,7 @@
       public void testTwoArgumentValues() throws Exception {
       	ArgumentBuilder builder = ArgumentBuilder.createBuilder();
       	
  -    	Argument files = builder.withSize(2).create("files");
  +    	Argument files = builder.withSize(2).withName("files").create();
       	
       	Options options = new Options();
       	options.add( files );
  @@ -322,7 +322,7 @@
       public void testJavaProperties() throws Exception {
   		ArgumentBuilder builder = ArgumentBuilder.createBuilder();
       	
  -		Argument files = builder.create("f");
  +		Argument files = builder.withName("f").create();
   		//Argument debug = builder.create("D");
       	
   		Options options = new Options();
  
  
  
  1.3.2.2   +8 -8      jakarta-commons/cli/src/test/org/apache/commons/cli/GnuParseTest.java
  
  Index: GnuParseTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/test/org/apache/commons/cli/GnuParseTest.java,v
  retrieving revision 1.3.2.1
  retrieving revision 1.3.2.2
  diff -u -r1.3.2.1 -r1.3.2.2
  --- GnuParseTest.java	19 May 2003 20:50:23 -0000	1.3.2.1
  +++ GnuParseTest.java	20 May 2003 23:08:54 -0000	1.3.2.2
  @@ -36,13 +36,13 @@
           _options = new Options();
           
           Option a = obuilder.withDescription("turn [a] on or off")
  -                          .create("a","enable-a");
  +                          .withName("a").withLongName("enable-a").create();
           _options.add( a ); 
           Argument b = abuilder.withDescription("set the values of [b]")
  -                          .create("b", "bfile");
  +                          .withName("b").withLongName("bfile").create();
   		_options.add( b ); 
           Option c = obuilder.withDescription("turn [c] on or off")
  -                           .create("c", "copt");
  +                           .withName("c").withLongName("copt").create();
   		_options.add( c );
   		
   		_options.add( abuilder.createAnonymous("anon")); 
  @@ -225,13 +225,13 @@
       	
   		Options opts = new Options();
           
  -		opts.add( obuilder.isRequired()
  +		opts.add( obuilder.withRequired(true)
   					   .withDescription("toggle -a")
  -					   .create("a", "a"));
  +					   .withName("a").withLongName("a").create());
   
  -		opts.add( abuilder.isRequired()
  +		opts.add( abuilder.withRequired(false)
   					   .withDescription("toggle -a*")
  -					   .create("a", "a"));
  +					   .withName("a").withLongName("a").create());
           
   		assertEquals( "last one in wins", "toggle -a*", opts.getOption("-a").getDescription()
);
   		assertEquals( "last one in wins", "toggle -a*", opts.getOption("--a").getDescription()
);
  
  
  
  1.5.2.2   +12 -12    jakarta-commons/cli/src/test/org/apache/commons/cli/OptionGroupTest.java
  
  Index: OptionGroupTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/test/org/apache/commons/cli/OptionGroupTest.java,v
  retrieving revision 1.5.2.1
  retrieving revision 1.5.2.2
  diff -u -r1.5.2.1 -r1.5.2.2
  --- OptionGroupTest.java	19 May 2003 20:50:23 -0000	1.5.2.1
  +++ OptionGroupTest.java	20 May 2003 23:08:54 -0000	1.5.2.2
  @@ -41,9 +41,9 @@
   		ArgumentBuilder abuilder = new ArgumentBuilder();
       	
   		Option file = builder.withDescription("file to process")
  -							.create("f","file"); 
  +							.withName("f").withLongName("file").create(); 
   		Option dir = builder.withDescription("directory to process")
  -							.create("d","directory"); 
  +							.withName("d").withLongName("directory").create(); 
           //new Option( "f", "file", false, "file to process" );
           //Option dir = new Option( "d", "directory", false, "directory to process" );
           ExclusiveOptionGroup group = new ExclusiveOptionGroup();
  @@ -53,9 +53,9 @@
           _options.add( group );
   
   		Option section = builder.withDescription("section to process")
  -							.create("s","section"); 
  +							.withName("s").withLongName("section").create(); 
   		Option chapter = builder.withDescription("chapter to process")
  -							.create("c","chapter"); 
  +							.withName("c").withLongName("chapter").create(); 
   
           //Option section = new Option( "s", "section", false, "section to process" );
           //Option chapter = new Option( "c", "chapter", false, "chapter to process" );
  @@ -66,9 +66,9 @@
           _options.add( group2 );
   
   		Option importOpt = builder.withDescription("import to process")
  -							.create(null,"import"); 
  +							.withLongName("import").create(); 
   		Option exportOpt = builder.withDescription("export to process")
  -							.create(null,"export"); 
  +							.withLongName("export").create(); 
   
           //Option importOpt = new Option( null, "import", false, "section to process" );
           //Option exportOpt = new Option( null, "export", false, "chapter to process" );
  @@ -78,7 +78,7 @@
           _options.add( group3 );
   
   		Option revision = builder.withDescription("revision number")
  -							.create("r","revision"); 
  +							.withName("r").withLongName("revision").create(); 
   
           _options.add( revision );
           
  @@ -278,8 +278,8 @@
       
       public void testInclusiveOption() throws Exception {
       	OptionBuilder builder = new OptionBuilder();
  -		Option a = builder.create("a");	
  -		Option b = builder.create("b");
  +		Option a = builder.withName("a").create();	
  +		Option b = builder.withName("b").create();
   		InclusiveOptionGroup group = new InclusiveOptionGroup();
   		group.add(a);
   		group.add(b);
  @@ -294,9 +294,9 @@
       
       public void testSetAndOption() throws Exception {
   		ArgumentBuilder builder = new ArgumentBuilder();
  -		Argument o = builder.create("o");
  -		Argument g = builder.isRequired().create("g");
  -		Argument I = builder.create("I");
  +		Argument o = builder.withName("o").create();
  +		Argument g = builder.withRequired(true).withName("g").create();
  +		Argument I = builder.withName("I").create();
   		
   	    ExclusiveOptionGroup group = new ExclusiveOptionGroup();
   	    
  
  
  
  1.1.2.2   +9 -9      jakarta-commons/cli/src/test/org/apache/commons/cli/OptionsTest.java
  
  Index: OptionsTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/test/org/apache/commons/cli/OptionsTest.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- OptionsTest.java	19 May 2003 20:50:23 -0000	1.1.2.1
  +++ OptionsTest.java	20 May 2003 23:08:54 -0000	1.1.2.2
  @@ -36,10 +36,10 @@
   		Options opts = new Options();
           
   		opts.add( obuilder.withDescription("toggle -a")
  -					   .create("a", "a"));
  +					   .withName("a").withLongName("a").create());
   
   		opts.add(abuilder.withDescription("toggle -a*")
  -						   .create("a", "a"));
  +						   .withName("a").withLongName("a").create());
           
   		assertEquals( "last one in wins", "toggle -a*", opts.getOption("-a").getDescription()
);
   		assertEquals( "last one in wins", "toggle -a*", opts.getOption("--a").getDescription()
);
  @@ -49,22 +49,22 @@
           OptionBuilder builder = new OptionBuilder();
           
   		Option longOnly1 = builder
  -			.create(null, "long-only1");
  +			.withLongName("long-only1").create();
           
   		Option longOnly2 = builder
  -			.create(null, "long-only2");
  +			.withLongName("long-only2").create();
                   
   		Option shortOnly1 = builder
  -			.create("1");
  +			.withName("1").create();
                   
   		Option shortOnly2 = builder
  -			.create("2");
  +			.withName("2").create();
                   
   		Option bothA = builder
  -			.create("a", "bothA");
  +			.withName("a").withLongName("bothA").create();
                   
   		Option bothB = builder
  -			.create("b", "bothB");
  +			.withName("b").withLongName("bothB").create();
           
   		Options options = new Options();
   		options.add(longOnly1);
  
  
  
  1.5.2.2   +3 -3      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.5.2.1
  retrieving revision 1.5.2.2
  diff -u -r1.5.2.1 -r1.5.2.2
  --- ParseRequiredTest.java	19 May 2003 20:50:23 -0000	1.5.2.1
  +++ ParseRequiredTest.java	20 May 2003 23:08:54 -0000	1.5.2.2
  @@ -41,11 +41,11 @@
           
           _options.add( 
               obuilder.withDescription("turn [a] on or off")
  -               .create("a", "enable-a"));
  +               .withName("a").withLongName("enable-a").create());
                  
  -        _options.add( abuilder.isRequired()
  +        _options.add( abuilder.withRequired(true)
                 .withDescription( "set the value of [b]" )
  -              .create("b", "bfile") );
  +              .withName("b").withLongName("bfile").create() );
           
           /*OptionBuilder.withLongOpt( "bfile" )
                                        .hasArg()
  
  
  
  1.6.2.2   +3 -3      jakarta-commons/cli/src/test/org/apache/commons/cli/ParseTest.java
  
  Index: ParseTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/test/org/apache/commons/cli/ParseTest.java,v
  retrieving revision 1.6.2.1
  retrieving revision 1.6.2.2
  diff -u -r1.6.2.1 -r1.6.2.2
  --- ParseTest.java	19 May 2003 20:50:23 -0000	1.6.2.1
  +++ ParseTest.java	20 May 2003 23:08:54 -0000	1.6.2.2
  @@ -36,11 +36,11 @@
       	
           options = new Options();
           options.add( obuilder.withDescription("turn [a] on or off")
  -             .create("a", "enable-a"));
  +             .withName("a").withLongName("enable-a").create());
           options.add( abuilder.withDescription("set the value of [b]")
  -		    .create("b","bfile"));
  +		    .withName("b").withLongName("bfile").create());
           options.add( obuilder.withDescription("turn [c] on or off")
  -            .create("c", "copt"));
  +            .withName("c").withLongName("copt").create());
   		options.add( abuilder.createAnonymous("anon") );
   	    parser = new CommandLineParser();
       }
  
  
  
  1.7.2.2   +11 -11    jakarta-commons/cli/src/test/org/apache/commons/cli/ValueTest.java
  
  Index: ValueTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/test/org/apache/commons/cli/ValueTest.java,v
  retrieving revision 1.7.2.1
  retrieving revision 1.7.2.2
  diff -u -r1.7.2.1 -r1.7.2.2
  --- ValueTest.java	19 May 2003 20:50:23 -0000	1.7.2.1
  +++ ValueTest.java	20 May 2003 23:08:54 -0000	1.7.2.2
  @@ -36,14 +36,14 @@
       	ArgumentBuilder abuilder = new ArgumentBuilder();
       	
       	Option a = obuilder.withDescription("toggle -a")
  -    	    .create("a");
  +    	    .withName("a").create();
       	opts.add(a);   
           //opts.addOption("a",
           //               false,
           //               "toggle -a");
   
   		Argument b = abuilder.withDescription("set -b")
  -		    .create("b");
  +		    .withName("b").create();
   		opts.add(b);   
   		    
           //opts.addOption("b",
  @@ -51,7 +51,7 @@
           //               "set -b");
   
           Option c = obuilder.withDescription("toggle -c")
  -            .create("c", "c");
  +            .withName("c").withLongName("c").create();
   		opts.add(c);   
               
           //opts.addOption("c",
  @@ -60,7 +60,7 @@
           //               "toggle -c");
   
   		Argument d = abuilder.withDescription("set -d")
  -			.create("d", "d");
  +			.withName("d").withLongName("d").create();
   		opts.add(d);   
   			
           //opts.addOption("d",
  @@ -69,14 +69,14 @@
           //               "set -d");
   
   		Argument e = abuilder.hasOptionalValues()
  -			.create("e");
  +			.withName("e").create();
   		opts.add(e);   
   
           //opts.addOption( OptionBuilder.hasOptionalArg()
           //                .create( 'e') );
   
   		Argument fish = abuilder.hasOptionalValues()
  -			.create(null, "fish");
  +			.withLongName("fish").create();
   		opts.add(fish);   
   			
           //opts.addOption( OptionBuilder.hasOptionalArg()
  @@ -85,7 +85,7 @@
   
   		Argument gravy = abuilder.hasOptionalValues()
   		    .withSize(100)
  -			.create(null, "gravy");
  +			.withLongName("gravy").create();
   		opts.add(gravy);   
   
           //opts.addOption( OptionBuilder.hasOptionalArgs()
  @@ -94,7 +94,7 @@
   
   		Argument hide = abuilder.hasOptionalValues()
   		    .withSize(2)
  -			.create(null, "hide");
  +			.withLongName("hide").create();
   		opts.add(hide);   
   
           //opts.addOption( OptionBuilder.hasOptionalArgs( 2 )
  @@ -103,7 +103,7 @@
   
   		Argument i = abuilder.hasOptionalValues()
   		    .withSize(2)
  -			.create("i");
  +			.withName("i").create();
   		opts.add(i);   
   
           //opts.addOption( OptionBuilder.hasOptionalArgs( 2 )
  @@ -111,7 +111,7 @@
   
   		Argument j = abuilder.hasOptionalValues()
   		    .withSize(2)
  -			.create("j");
  +			.withName("j").create();
   		opts.add(j);   
   			
           //opts.addOption( OptionBuilder.hasOptionalArgs( )
  @@ -119,7 +119,7 @@
   
   		Argument k = abuilder.hasOptionalValues()
   		    .withValueSeparator(',')
  -			.create("k");
  +			.withName("k").create();
   		opts.add(k);   
   
           //opts.addOption( OptionBuilder.hasArgs( ).withValueSeparator( ',' )
  
  
  
  1.1.2.2   +6 -6      jakarta-commons/cli/src/test/org/apache/commons/cli/Attic/ValueTypeTest.java
  
  Index: ValueTypeTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/test/org/apache/commons/cli/Attic/ValueTypeTest.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- ValueTypeTest.java	19 May 2003 20:47:50 -0000	1.1.2.1
  +++ ValueTypeTest.java	20 May 2003 23:08:54 -0000	1.1.2.2
  @@ -24,7 +24,7 @@
       	ArgumentBuilder builder = ArgumentBuilder.createBuilder();
       	
           Argument string = builder.withValueType( String.class )
  -        .create( "str" );
  +        .withName( "str" ).create();
   
           Options opts = new Options();
           opts.add( string );
  @@ -40,7 +40,7 @@
       public void testFloatValue() throws Exception {
   		ArgumentBuilder builder = ArgumentBuilder.createBuilder();
           Argument floatArg = builder.withValueType( Number.class )
  -        .create ( "f" );
  +        .withName ( "f" ).create();
   
           Options opts = new Options();
           opts.add( floatArg );
  @@ -62,7 +62,7 @@
       public void testIntegerValue() throws Exception {
   		ArgumentBuilder builder = ArgumentBuilder.createBuilder();
           Argument integerArg = builder.withValueType( Number.class )
  -        .create( "n" );
  +        .withName( "n" ).create();
   
           Options opts = new Options();
           opts.add( integerArg );
  @@ -84,7 +84,7 @@
       public void testClassValue() throws Exception {
   		ArgumentBuilder builder = ArgumentBuilder.createBuilder();
           Argument classArg = builder.withValueType( Class.class )
  -        .create( "c" );
  +        .withName( "c" ).create();
   
           Options opts = new Options();
           opts.add( classArg );
  @@ -106,7 +106,7 @@
       public void testFileValue() throws Exception {
   		ArgumentBuilder builder = ArgumentBuilder.createBuilder();
           Argument fileArg = builder.withValueType( java.io.File.class )
  -        .create( "f" );
  +        .withName( "f" ).create();
   
           Options opts = new Options();
           opts.add( fileArg );
  @@ -124,7 +124,7 @@
       public void testURLValue() throws Exception {
   		ArgumentBuilder builder = ArgumentBuilder.createBuilder();
           Argument urlArg = builder.withValueType( java.net.URL.class )
  -        .create( "u" );
  +        .withName( "u" ).create();
   
           Options opts = new Options();
           opts.add( urlArg );
  
  
  

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


Mime
View raw message