cvs commit: jakarta-commons/cli/src/test/org/apache/commons/cli2 DocumentationTest.java

2004-12-27 Thread roxspring
roxspring2004/12/27 09:41:28

  Modified:cli/xdocs/examples ant.xml
   cli/src/test/org/apache/commons/cli2 DocumentationTest.java
  Log:
  Documented ant example
  
  Revision  ChangesPath
  1.2   +266 -1jakarta-commons/cli/xdocs/examples/ant.xml
  
  Index: ant.xml
  ===
  RCS file: /home/cvs/jakarta-commons/cli/xdocs/examples/ant.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ant.xml   2 Sep 2004 13:58:16 -   1.1
  +++ ant.xml   27 Dec 2004 17:41:27 -  1.2
  @@ -23,12 +23,277 @@
   
 body
   section name=ant
  -  pTODO what is ant/p
  +  p
  +This example works through modelling Apache Ant using CLI2, the 
  +example is based on Apache Ant version 1.6.1 compiled on February 12 
  +2004.
  +  /p
  +  p
  +Apache Ant is a Java-based build tool. In theory, it is kind of 
like 
  +Make, but without Make's wrinkles. - For more information please 
  +visit a href=http://ant.apache.org/;http://ant.apache.org//a
  +  /p
 subsection name=Modelling
  +  p
  +To model the ant options we first need to create some Builders so 
that 
  +each of the option instances can be created:
  +  /p
  +sourcefinal DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
  +final ArgumentBuilder abuilder = new ArgumentBuilder();
  +final GroupBuilder gbuilder = new GroupBuilder();/source
  +  p
  + For each option we create an Option instance that will model 
it, built 
  + using the Builder instances above:
  +  /p
  +sourceOption help =
  +obuilder
  +.withShortName(help)
  +.withShortName(h)
  +.withDescription(print this message)
  +.create();
  +Option projecthelp =
  +obuilder
  +.withShortName(projecthelp)
  +.withShortName(p)
  +.withDescription(print project help information)
  +.create();
  +Option version =
  +obuilder
  +.withShortName(version)
  +.withDescription(print the version information and exit)
  +.create();
  +Option diagnostics =
  +obuilder
  +.withShortName(diagnostics)
  +.withDescription(print information that might be helpful to 
diagnose or report problems.)
  +.create();
  +Option quiet =
  +obuilder
  +.withShortName(quiet)
  +.withShortName(q)
  +.withDescription(be extra quiet)
  +.create();
  +Option verbose =
  +obuilder
  +.withShortName(verbose)
  +.withShortName(v)
  +.withDescription(be extra verbose)
  +.create();
  +Option debug =
  +obuilder
  +.withShortName(debug)
  +.withShortName(d)
  +.withDescription(print debugging information)
  +.create();
  +Option emacs =
  +obuilder
  +.withShortName(emacs)
  +.withShortName(e)
  +.withDescription(produce logging information without adornments)
  +.create();
  +Option lib =
  +obuilder
  +.withShortName(lib)
  +.withDescription(specifies a path to search for jars and classes)
  +.withArgument(
  +abuilder
  +.withName(path)
  +.withMinimum(1)
  +.withMaximum(1)
  +.create())
  +.create();
  +Option logfile =
  +obuilder
  +.withShortName(logfile)
  +.withShortName(l)
  +.withDescription(use given file for log)
  +.withArgument(
  +abuilder
  +.withName(file)
  +.withMinimum(1)
  +.withMaximum(1)
  +.create())
  +.create();
  +Option logger =
  +obuilder
  +.withShortName(logger)
  +.withDescription(the class which is to perform logging)
  +.withArgument(
  +abuilder
  +.withName(classname)
  +.withMinimum(1)
  +.withMaximum(1)
  +.create())
  +.create();
  +Option listener =
  +obuilder
  +.withShortName(listener)
  +.withDescription(add an instance of class as a project listener)
  +.withArgument(
  +abuilder
  +.withName(classname)
  +.withMinimum(1)
  +.withMaximum(1)
  +.create())
  +.create();
  +Option noinput =
  +obuilder
  +.withShortName(noinput)
  +.withDescription(do not allow interactive input)
  +.create();
  +Option buildfile =
  +obuilder
  +.withShortName(buildfile)
  +.withShortName(file)
  +.withShortName(f)
  +.withDescription(use given buildfile)
  +.withArgument(
  +abuilder
  +.withName(file)
  +

cvs commit: jakarta-commons/cli/src/test/org/apache/commons/cli2 DocumentationTest.java

2004-03-30 Thread roxspring
roxspring2004/03/30 11:15:22

  Modified:cli/src/java/org/apache/commons/cli2/impl Tag:
RESEARCH_CLI_2_ROXSPRING GroupImpl.java
ParentImpl.java ArgumentImpl.java
PropertyOption.java Switch.java DefaultOption.java
Command.java OptionImpl.java
   cli/src/java/org/apache/commons/cli2 Tag:
RESEARCH_CLI_2_ROXSPRING HelpFormatter.java
OptionException.java
   cli/src/test/org/apache/commons/cli2/impl Tag:
RESEARCH_CLI_2_ROXSPRING PropertyOptionTest.java
GroupTest.java ArgumentTest.java ParentTest.java
CommandTest.java SwitchTest.java
DefaultOptionTest.java
   cli/src/test/org/apache/commons/cli2 Tag:
RESEARCH_CLI_2_ROXSPRING DocumentationTest.java
  Added:   cli/src/java/org/apache/commons/cli2 Tag:
RESEARCH_CLI_2_ROXSPRING DisplaySetting.java
  Removed: cli/src/java/org/apache/commons/cli2 Tag:
RESEARCH_CLI_2_ROXSPRING HelpSetting.java
  Log:
  Renamed HelpSetting to DisplaySetting so that the name better matches the use
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.1.2.17  +13 -13
jakarta-commons/cli/src/java/org/apache/commons/cli2/impl/Attic/GroupImpl.java
  
  Index: GroupImpl.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli2/impl/Attic/GroupImpl.java,v
  retrieving revision 1.1.2.16
  retrieving revision 1.1.2.17
  diff -u -r1.1.2.16 -r1.1.2.17
  --- GroupImpl.java30 Mar 2004 01:43:09 -  1.1.2.16
  +++ GroupImpl.java30 Mar 2004 19:15:21 -  1.1.2.17
  @@ -31,7 +31,7 @@
   import org.apache.commons.cli2.Argument;
   import org.apache.commons.cli2.Group;
   import org.apache.commons.cli2.HelpLine;
  -import org.apache.commons.cli2.HelpSetting;
  +import org.apache.commons.cli2.DisplaySetting;
   import org.apache.commons.cli2.Option;
   import org.apache.commons.cli2.OptionException;
   import org.apache.commons.cli2.WriteableCommandLine;
  @@ -301,24 +301,24 @@
   
   final boolean optional =
   minimum == 0
  - helpSettingsCopy.contains(HelpSetting.DISPLAY_OPTIONAL);
  + helpSettingsCopy.contains(DisplaySetting.DISPLAY_OPTIONAL);
   
   final boolean expanded =
   name == null
  -|| helpSettingsCopy.contains(HelpSetting.DISPLAY_GROUP_EXPANDED);
  +|| helpSettingsCopy.contains(DisplaySetting.DISPLAY_GROUP_EXPANDED);
   
   final boolean named =
   !expanded
   || (name != null
  - helpSettingsCopy.contains(HelpSetting.DISPLAY_GROUP_NAME));
  + 
helpSettingsCopy.contains(DisplaySetting.DISPLAY_GROUP_NAME));
   
   final boolean arguments =
  -helpSettingsCopy.contains(HelpSetting.DISPLAY_GROUP_ARGUMENT);
  +helpSettingsCopy.contains(DisplaySetting.DISPLAY_GROUP_ARGUMENT);
   
   final boolean outer =
  -helpSettingsCopy.contains(HelpSetting.DISPLAY_GROUP_OUTER);
  +helpSettingsCopy.contains(DisplaySetting.DISPLAY_GROUP_OUTER);
   
  -helpSettingsCopy.remove(HelpSetting.DISPLAY_GROUP_OUTER);
  +helpSettingsCopy.remove(DisplaySetting.DISPLAY_GROUP_OUTER);
   
   final boolean both = named  expanded;
   
  @@ -335,12 +335,12 @@
   if (expanded) {
   final Set childSettings;
   if (!helpSettingsCopy
  -.contains(HelpSetting.DISPLAY_GROUP_EXPANDED)) {
  -childSettings = HelpSetting.NONE;
  +.contains(DisplaySetting.DISPLAY_GROUP_EXPANDED)) {
  +childSettings = DisplaySetting.NONE;
   }
   else {
   childSettings = new HashSet(helpSettingsCopy);
  -childSettings.remove(HelpSetting.DISPLAY_OPTIONAL);
  +childSettings.remove(DisplaySetting.DISPLAY_OPTIONAL);
   }
   
   // grab a list of the group's options.
  @@ -398,11 +398,11 @@
   final Set helpSettings,
   final Comparator comp) {
   final List helpLines = new ArrayList();
  -if (helpSettings.contains(HelpSetting.DISPLAY_GROUP_NAME)) {
  +if (helpSettings.contains(DisplaySetting.DISPLAY_GROUP_NAME)) {
   final HelpLine helpLine = new HelpLineImpl(this, depth);
   helpLines.add(helpLine);
   }
  -if (helpSettings.contains(HelpSetting.DISPLAY_GROUP_EXPANDED)) {
  +if (helpSettings.contains(DisplaySetting.DISPLAY_GROUP_EXPANDED)) {
   
   // grab a list of the group's options.