Skip to content

Commit 634bad0

Browse files
committed
Merged HelpFormatterExamples into ApplicationTest
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/cli/branches/cli-1.x@712640 13f79535-47bb-0310-9956-ffa450edef68
1 parent db4a638 commit 634bad0

2 files changed

Lines changed: 49 additions & 114 deletions

File tree

src/test/org/apache/commons/cli/ApplicationTest.java

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
* <li>ls</li>
2929
* <li>Ant</li>
3030
* <li>Groovy</li>
31+
* <li>man</li>
3132
* </ul>
3233
* </p>
3334
*
@@ -169,4 +170,52 @@ public void testGroovy() throws Exception {
169170
assertEquals("println 'hello'", line.getOptionValue('e'));
170171
}
171172

173+
/**
174+
* @author Slawek Zachcial
175+
*/
176+
public void testMan()
177+
{
178+
String cmdLine =
179+
"man [-c|-f|-k|-w|-tZT device] [-adlhu7V] [-Mpath] [-Ppager] [-Slist] " +
180+
"[-msystem] [-pstring] [-Llocale] [-eextension] [section] page ...";
181+
Options options = new Options().
182+
addOption("a", "all", false, "find all matching manual pages.").
183+
addOption("d", "debug", false, "emit debugging messages.").
184+
addOption("e", "extension", false, "limit search to extension type 'extension'.").
185+
addOption("f", "whatis", false, "equivalent to whatis.").
186+
addOption("k", "apropos", false, "equivalent to apropos.").
187+
addOption("w", "location", false, "print physical location of man page(s).").
188+
addOption("l", "local-file", false, "interpret 'page' argument(s) as local filename(s)").
189+
addOption("u", "update", false, "force a cache consistency check.").
190+
//FIXME - should generate -r,--prompt string
191+
addOption("r", "prompt", true, "provide 'less' pager with prompt.").
192+
addOption("c", "catman", false, "used by catman to reformat out of date cat pages.").
193+
addOption("7", "ascii", false, "display ASCII translation or certain latin1 chars.").
194+
addOption("t", "troff", false, "use troff format pages.").
195+
//FIXME - should generate -T,--troff-device device
196+
addOption("T", "troff-device", true, "use groff with selected device.").
197+
addOption("Z", "ditroff", false, "use groff with selected device.").
198+
addOption("D", "default", false, "reset all options to their default values.").
199+
//FIXME - should generate -M,--manpath path
200+
addOption("M", "manpath", true, "set search path for manual pages to 'path'.").
201+
//FIXME - should generate -P,--pager pager
202+
addOption("P", "pager", true, "use program 'pager' to display output.").
203+
//FIXME - should generate -S,--sections list
204+
addOption("S", "sections", true, "use colon separated section list.").
205+
//FIXME - should generate -m,--systems system
206+
addOption("m", "systems", true, "search for man pages from other unix system(s).").
207+
//FIXME - should generate -L,--locale locale
208+
addOption("L", "locale", true, "defaine the locale for this particular man search.").
209+
//FIXME - should generate -p,--preprocessor string
210+
addOption("p", "preprocessor", true, "string indicates which preprocessor to run.\n" +
211+
" e - [n]eqn p - pic t - tbl\n" +
212+
" g - grap r - refer v - vgrind").
213+
addOption("V", "version", false, "show version.").
214+
addOption("h", "help", false, "show this usage message.");
215+
216+
HelpFormatter hf = new HelpFormatter();
217+
//hf.printHelp(cmdLine, opts);
218+
hf.printHelp(60, cmdLine, null, options, null);
219+
}
220+
172221
}

src/test/org/apache/commons/cli/HelpFormatterExamples.java

Lines changed: 0 additions & 114 deletions
This file was deleted.

0 commit comments

Comments
 (0)