3434 * A formatter of help messages for command line options.
3535 *
3636 * <p>Example:</p>
37- *
37+ *
3838 * <pre>
3939 * Options options = new Options();
4040 * options.addOption(OptionBuilder.withLongOpt("file")
4747 * .withDescription("Print the version of the application")
4848 * .create('v'));
4949 * options.addOption(OptionBuilder.withLongOpt("help").create('h'));
50- *
50+ *
5151 * String header = "Do something useful with an input file\n\n";
5252 * String footer = "\nPlease report issues at http://example.com/issues";
53- *
53+ *
5454 * HelpFormatter formatter = new HelpFormatter();
5555 * formatter.printHelp("myapp", header, options, footer, true);
5656 * </pre>
57- *
57+ *
5858 * This produces the following output:
59- *
59+ *
6060 * <pre>
6161 * usage: myapp -f <FILE> [-h] [-v]
6262 * Do something useful with an input file
63- *
63+ *
6464 * -f,--file <FILE> The file to be processed
6565 * -h,--help
6666 * -v,--version Print the version of the application
67- *
67+ *
6868 * Please report issues at http://example.com/issues
6969 * </pre>
7070 */
@@ -90,9 +90,9 @@ public class HelpFormatter
9090 /** default prefix for long Option */
9191 public static final String DEFAULT_LONG_OPT_PREFIX = "--" ;
9292
93- /**
93+ /**
9494 * default separator displayed between a long Option and its value
95- *
95+ *
9696 * @since 1.3
9797 **/
9898 public static final String DEFAULT_LONG_OPT_SEPARATOR = " " ;
@@ -177,7 +177,7 @@ public class HelpFormatter
177177
178178 /**
179179 * Comparator used to sort the options when they output in help text
180- *
180+ *
181181 * Defaults to case-insensitive alphabetical sorting by option key
182182 */
183183 protected Comparator <Option > optionComparator = new OptionComparator ();
@@ -329,7 +329,7 @@ public String getLongOptPrefix()
329329 * Set the separator displayed between a long option and its value.
330330 * Ensure that the separator specified is supported by the parser used,
331331 * typically ' ' or '='.
332- *
332+ *
333333 * @param longOptSeparator the separator, typically ' ' or '='.
334334 * @since 1.3
335335 */
@@ -340,7 +340,7 @@ public void setLongOptSeparator(final String longOptSeparator)
340340
341341 /**
342342 * Returns the separator displayed between a long option and its value.
343- *
343+ *
344344 * @return the separator
345345 * @since 1.3
346346 */
@@ -408,7 +408,7 @@ public void printHelp(final String cmdLineSyntax, final Options options)
408408
409409 /**
410410 * Print the help for <code>options</code> with the specified
411- * command line syntax. This method prints help information to
411+ * command line syntax. This method prints help information to
412412 * System.out.
413413 *
414414 * @param cmdLineSyntax the syntax for this application
@@ -438,7 +438,7 @@ public void printHelp(final String cmdLineSyntax, final String header, final Opt
438438
439439 /**
440440 * Print the help for <code>options</code> with the specified
441- * command line syntax. This method prints help information to
441+ * command line syntax. This method prints help information to
442442 * System.out.
443443 *
444444 * @param cmdLineSyntax the syntax for this application
@@ -479,7 +479,7 @@ public void printHelp(final int width, final String cmdLineSyntax, final String
479479 * @param header the banner to display at the beginning of the help
480480 * @param options the Options instance
481481 * @param footer the banner to display at the end of the help
482- * @param autoUsage whether to print an automatically generated
482+ * @param autoUsage whether to print an automatically generated
483483 * usage statement
484484 */
485485 public void printHelp (final int width , final String cmdLineSyntax , final String header ,
@@ -508,8 +508,8 @@ public void printHelp(final int width, final String cmdLineSyntax, final String
508508 *
509509 * @throws IllegalStateException if there is no room to print a line
510510 */
511- public void printHelp (final PrintWriter pw , final int width , final String cmdLineSyntax ,
512- final String header , final Options options , final int leftPad ,
511+ public void printHelp (final PrintWriter pw , final int width , final String cmdLineSyntax ,
512+ final String header , final Options options , final int leftPad ,
513513 final int descPad , final String footer )
514514 {
515515 printHelp (pw , width , cmdLineSyntax , header , options , leftPad , descPad , footer , false );
@@ -569,7 +569,7 @@ public void printHelp(final PrintWriter pw, final int width, final String cmdLin
569569 /**
570570 * Prints the usage statement for the specified application.
571571 *
572- * @param pw The PrintWriter to print the usage statement
572+ * @param pw The PrintWriter to print the usage statement
573573 * @param width The number of characters to display per line
574574 * @param app The application name
575575 * @param options The command line Options
@@ -596,7 +596,7 @@ public void printUsage(final PrintWriter pw, final int width, final String app,
596596 // check if the option is part of an OptionGroup
597597 final OptionGroup group = options .getOptionGroup (option );
598598
599- // if the option is part of a group
599+ // if the option is part of a group
600600 if (group != null )
601601 {
602602 // and if the group has not already been processed
@@ -632,7 +632,7 @@ public void printUsage(final PrintWriter pw, final int width, final String app,
632632 }
633633
634634 /**
635- * Appends the usage clause for an OptionGroup to a StringBuffer.
635+ * Appends the usage clause for an OptionGroup to a StringBuffer.
636636 * The clause is wrapped in square brackets if the group is required.
637637 * The display of the options is handled by appendOption
638638 * @param buff the StringBuffer to append to
@@ -670,7 +670,7 @@ private void appendOptionGroup(final StringBuffer buff, final OptionGroup group)
670670 }
671671
672672 /**
673- * Appends the usage clause for an Option to a StringBuffer.
673+ * Appends the usage clause for an Option to a StringBuffer.
674674 *
675675 * @param buff the StringBuffer to append to
676676 * @param option the Option to append
@@ -691,14 +691,14 @@ private void appendOption(final StringBuffer buff, final Option option, final bo
691691 {
692692 buff .append ("--" ).append (option .getLongOpt ());
693693 }
694-
694+
695695 // if the Option has a value and a non blank argname
696696 if (option .hasArg () && (option .getArgName () == null || option .getArgName ().length () != 0 ))
697697 {
698698 buff .append (option .getOpt () == null ? longOptSeparator : " " );
699699 buff .append ("<" ).append (option .getArgName () != null ? option .getArgName () : getArgName ()).append (">" );
700700 }
701-
701+
702702 // if the Option is not a required option
703703 if (!required )
704704 {
@@ -722,7 +722,7 @@ public void printUsage(final PrintWriter pw, final int width, final String cmdLi
722722 }
723723
724724 /**
725- * Print the help for the specified Options to the specified writer,
725+ * Print the help for the specified Options to the specified writer,
726726 * using the specified width, left padding and description padding.
727727 *
728728 * @param pw The printWriter to write the help to
@@ -733,7 +733,7 @@ public void printUsage(final PrintWriter pw, final int width, final String cmdLi
733733 * @param descPad the number of characters of padding to be prefixed
734734 * to each description line
735735 */
736- public void printOptions (final PrintWriter pw , final int width , final Options options ,
736+ public void printOptions (final PrintWriter pw , final int width , final Options options ,
737737 final int leftPad , final int descPad )
738738 {
739739 final StringBuffer sb = new StringBuffer ();
@@ -791,9 +791,9 @@ protected StringBuffer renderOptions(final StringBuffer sb, final int width, fin
791791 final String lpad = createPadding (leftPad );
792792 final String dpad = createPadding (descPad );
793793
794- // first create list containing only <lpad>-a,--aaa where
795- // -a is opt and --aaa is long opt; in parallel look for
796- // the longest opt string this list will be then used to
794+ // first create list containing only <lpad>-a,--aaa where
795+ // -a is opt and --aaa is long opt; in parallel look for
796+ // the longest opt string this list will be then used to
797797 // sort options ascending
798798 int max = 0 ;
799799 final List <StringBuffer > prefixList = new ArrayList <StringBuffer >();
@@ -885,7 +885,7 @@ protected StringBuffer renderOptions(final StringBuffer sb, final int width, fin
885885 *
886886 * @return the StringBuffer with the rendered Options contents.
887887 */
888- protected StringBuffer renderWrappedText (final StringBuffer sb , final int width ,
888+ protected StringBuffer renderWrappedText (final StringBuffer sb , final int width ,
889889 int nextLineTabStop , String text )
890890 {
891891 int pos = findWrapPos (text , width , 0 );
@@ -968,7 +968,7 @@ private Appendable renderWrappedTextBlock(final StringBuffer sb, final int width
968968 /**
969969 * Finds the next text wrap position after <code>startPos</code> for the
970970 * text in <code>text</code> with the column width <code>width</code>.
971- * The wrap point is the last position before startPos+width having a
971+ * The wrap point is the last position before startPos+width having a
972972 * whitespace character (space, \n, \r). If there is no whitespace character
973973 * before startPos+width, it will return startPos+width.
974974 *
0 commit comments