Author: ebourg Date: Mon Nov 10 02:14:02 2008 New Revision: 712640 URL: http://svn.apache.org/viewvc?rev=712640&view=rev Log: Merged HelpFormatterExamples into ApplicationTest
Removed: commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/HelpFormatterExamples.java Modified: commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/ApplicationTest.java Modified: commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/ApplicationTest.java URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/ApplicationTest.java?rev=712640&r1=712639&r2=712640&view=diff ============================================================================== --- commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/ApplicationTest.java (original) +++ commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/ApplicationTest.java Mon Nov 10 02:14:02 2008 @@ -28,6 +28,7 @@ * <li>ls</li> * <li>Ant</li> * <li>Groovy</li> + * <li>man</li> * </ul> * </p> * @@ -169,4 +170,52 @@ assertEquals("println 'hello'", line.getOptionValue('e')); } + /** + * @author Slawek Zachcial + */ + public void testMan() + { + String cmdLine = + "man [-c|-f|-k|-w|-tZT device] [-adlhu7V] [-Mpath] [-Ppager] [-Slist] " + + "[-msystem] [-pstring] [-Llocale] [-eextension] [section] page ..."; + Options options = new Options(). + addOption("a", "all", false, "find all matching manual pages."). + addOption("d", "debug", false, "emit debugging messages."). + addOption("e", "extension", false, "limit search to extension type 'extension'."). + addOption("f", "whatis", false, "equivalent to whatis."). + addOption("k", "apropos", false, "equivalent to apropos."). + addOption("w", "location", false, "print physical location of man page(s)."). + addOption("l", "local-file", false, "interpret 'page' argument(s) as local filename(s)"). + addOption("u", "update", false, "force a cache consistency check."). + //FIXME - should generate -r,--prompt string + addOption("r", "prompt", true, "provide 'less' pager with prompt."). + addOption("c", "catman", false, "used by catman to reformat out of date cat pages."). + addOption("7", "ascii", false, "display ASCII translation or certain latin1 chars."). + addOption("t", "troff", false, "use troff format pages."). + //FIXME - should generate -T,--troff-device device + addOption("T", "troff-device", true, "use groff with selected device."). + addOption("Z", "ditroff", false, "use groff with selected device."). + addOption("D", "default", false, "reset all options to their default values."). + //FIXME - should generate -M,--manpath path + addOption("M", "manpath", true, "set search path for manual pages to 'path'."). + //FIXME - should generate -P,--pager pager + addOption("P", "pager", true, "use program 'pager' to display output."). + //FIXME - should generate -S,--sections list + addOption("S", "sections", true, "use colon separated section list."). + //FIXME - should generate -m,--systems system + addOption("m", "systems", true, "search for man pages from other unix system(s)."). + //FIXME - should generate -L,--locale locale + addOption("L", "locale", true, "defaine the locale for this particular man search."). + //FIXME - should generate -p,--preprocessor string + addOption("p", "preprocessor", true, "string indicates which preprocessor to run.\n" + + " e - [n]eqn p - pic t - tbl\n" + + " g - grap r - refer v - vgrind"). + addOption("V", "version", false, "show version."). + addOption("h", "help", false, "show this usage message."); + + HelpFormatter hf = new HelpFormatter(); + //hf.printHelp(cmdLine, opts); + hf.printHelp(60, cmdLine, null, options, null); + } + }