Clean up how the usage messages are printed

This also fixes an OOM issue when trying to print the usage message
on a terminal that doesn't report its width.
This commit is contained in:
Ben Gruver
2012-05-13 11:56:37 -07:00
parent 0044afa4c3
commit 36c2f08ba0
3 changed files with 30 additions and 37 deletions

View File

@ -31,12 +31,17 @@ package org.jf.util;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
public class smaliHelpFormatter extends HelpFormatter {
import java.io.PrintWriter;
public void smaliHelpFormatter() {
}
public void renderOptions(StringBuffer sb, Options options) {
super.renderOptions(sb, getWidth(), options, getLeftPadding(), this.getDescPadding());
public class SmaliHelpFormatter extends HelpFormatter {
public void printHelp(String cmdLineSyntax, String header, Options options, Options debugOptions) {
super.printHelp(cmdLineSyntax, header, options, "");
if (debugOptions != null) {
System.out.println();
System.out.println("Debug Options:");
PrintWriter pw = new PrintWriter(System.out);
super.printOptions(pw, getWidth(), debugOptions, getLeftPadding(), getDescPadding());
pw.flush();
}
}
}