Claudenw commented on code in PR #301:
URL: https://github.com/apache/creadur-rat/pull/301#discussion_r1763486210
##########
apache-rat-core/src/main/java/org/apache/rat/help/AbstractHelp.java:
##########
@@ -78,4 +80,98 @@ public static String createPadding(final int len) {
public static String header(final String txt) {
return String.format("%n====== %s ======%n",
WordUtils.capitalizeFully(txt));
}
+
+ public class RatHelpFormatter extends HelpFormatter {
+
+ RatHelpFormatter() {
+ super();
+ this.optionComparator = OptionCollection.optionComparator;
+ this.setWidth(HELP_WIDTH);
+ }
+
+ public void printHelp(final PrintWriter pw, final String
cmdLineSyntax, final String header, final Options options, final String footer)
{
+ if (StringUtils.isEmpty(cmdLineSyntax)) {
+ throw new IllegalArgumentException("cmdLineSyntax not
provided");
+ }
+
+ helpFormatter.printUsage(pw, HELP_WIDTH, cmdLineSyntax);
+
+ if (header != null && !header.isEmpty()) {
+ helpFormatter.printWrapped(pw, HELP_WIDTH, header);
+ }
+ printOptions(pw, HELP_WIDTH, options,
helpFormatter.getLeftPadding(), helpFormatter.getDescPadding());
+ if (footer != null && !footer.isEmpty()) {
+ helpFormatter.printWrapped(pw, helpFormatter.getWidth(),
footer);
+ }
+ }
+
+
+ protected StringBuffer renderOptions(final StringBuffer sb, final int
width, final Options options, final int leftPad, final int descPad) {
Review Comment:
It would be except that we have to call renderWrappedText() on line 169 and
that is a method from the base class in the commons cli library.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]