3030import java .util .List ;
3131
3232/**
33- * A formatter of help messages for the current command line options
33+ * A formatter of help messages for command line options.
3434 *
35+ * <p>Example:</p>
36+ *
37+ * <pre>
38+ * Options options = new Options();
39+ * options.addOption(OptionBuilder.withLongOpt("file")
40+ * .withDescription("The file to be processed")
41+ * .hasArg()
42+ * .withArgName("FILE")
43+ * .isRequired()
44+ * .create('f'));
45+ * options.addOption(OptionBuilder.withLongOpt("version")
46+ * .withDescription("Print the version of the application")
47+ * .create('v'));
48+ * options.addOption(OptionBuilder.withLongOpt("help").create('h'));
49+ *
50+ * String header = "Do something useful with an input file\n\n";
51+ * String footer = "\nPlease report issues at http://example.com/issues";
52+ *
53+ * HelpFormatter formatter = new HelpFormatter();
54+ * formatter.printHelp("myapp", header, options, footer, true);
55+ * </pre>
56+ *
57+ * This produces the following output:
58+ *
59+ * <pre>
60+ * usage: myapp -f <FILE> [-h] [-v]
61+ * Do something useful with an input file
62+ *
63+ * -f,--file <FILE> The file to be processed
64+ * -h,--help
65+ * -v,--version Print the version of the application
66+ *
67+ * Please report issues at http://example.com/issues
68+ * </pre>
69+ *
3570 * @author Slawek Zachcial
3671 * @author John Keyes (john at integralsource.com)
3772 * @version $Revision$, $Date$
@@ -46,10 +81,7 @@ public class HelpFormatter
4681 /** default padding to the left of each line */
4782 public static final int DEFAULT_LEFT_PAD = 1 ;
4883
49- /**
50- * the number of characters of padding to be prefixed
51- * to each description line
52- */
84+ /** number of space characters to be prefixed to each description line */
5385 public static final int DEFAULT_DESC_PAD = 3 ;
5486
5587 /** the string to display at the beginning of the usage statement */
0 commit comments