/*
 *  Copyright 2007-2008 University Of Southern California
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing,
 *  software distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package edu.usc.glidein.cli;

public class Option
{
	public static Option create() 
	{
		Option option = new Option();
		return option;
	}
	
	private String usage = null;
	private String description = null;
	private String option = null;
	private String longOption = null;
	private boolean argument = false;
	
	public Option() { }

	public Option setUsage(String usage)
	{
		this.usage = usage;
		return this;
	}
	
	public String getUsage()
	{
		return usage;
	}
	
	public Option setDescription(String description)
	{
		this.description = description;
		return this;
	}
	
	public String getDescription()
	{
		return description;
	}
	
	public Option setOption(String option)
	{
		this.option = option;
		return this;
	}
	
	public String getOption()
	{
		return option;
	}
	
	public Option setLongOption(String longOption)
	{
		this.longOption = longOption;
		return this;
	}
	
	public String getLongOption()
	{
		return longOption;
	}
	
	public Option hasArgument() {
		this.argument = true;
		return this;
	}
	
	public Option hasArgument(boolean argument) {
		this.argument = argument;
		return this;
	}
	
	public boolean getArgument() {
		return argument;
	}
	
	public org.apache.commons.cli.Option buildOption()
	{
		org.apache.commons.cli.Option opt = 
			new org.apache.commons.cli.Option(
					option,longOption,argument,description);
		return opt;
		
	}
}

@@ -929,16 +929,59 @@
  false;%0A
+%09private boolean optionalArgument = false;%0A
 %09%0A%09publi
@@ -1624,25 +1624,26 @@
 asArgument()
- 
+%0A%09
 %7B%0A%09%09this.arg
@@ -1724,30 +1724,308 @@
 ent)
- %7B%0A%09%09this.argument = a
+%0A%09%7B%0A%09%09this.argument = argument;%0A%09%09return this;%0A%09%7D%0A%09%0A%09public boolean getArgument()%0A%09%7B%0A%09%09return argument;%0A%09%7D%0A%09%0A%09public Option hasOptionalArgument()%0A%09%7B%0A%09%09this.optionalArgument = true;%0A%09%09return this;%0A%09%7D%0A%09%0A%09public Option hasOptionalArgument(boolean optionalArgument)%0A%09%7B%0A%09%09this.optionalArgument = optionalA
 rgum
@@ -2060,32 +2060,40 @@
 blic boolean get
+Optional
 Argument() %7B%0A%09%09r
@@ -2086,17 +2086,18 @@
 gument()
- 
+%0A%09
 %7B%0A%09%09retu
@@ -2091,33 +2091,41 @@
 t()%0A%09%7B%0A%09%09return 
-a
+optionalA
 rgument;%0A%09%7D%0A%09%0A%09p
@@ -2177,16 +2177,74 @@
 on()%0A%09%7B%0A
+%09%09org.apache.commons.cli.OptionBuilder.hasOptionalArgs();%0A
 %09%09org.ap
@@ -2358,16 +2358,96 @@
 ption);%0A
+%09%09opt.setOptionalArg(optionalArgument);%0A%09%09if (optionalArgument) opt.setArgs(1);%0A
 %09%09return
@@ -2456,11 +2456,8 @@
 pt;%0A
-%09%09%0A
 %09%7D%0A%7D

Allow optional arguments