/** * Print the help for <code>options</code> with the specified * command line syntax. This method prints help information to * System.out. * * @param cmdLineSyntax the syntax for this application * @param options the Options instance */ public void printHelp(String cmdLineSyntax, Options options) { printHelp(getWidth(), cmdLineSyntax, null, options, null, false); }
/** * Print the help for <code>options</code> with the specified * command line syntax. This method prints help information to * System.out. * * @param cmdLineSyntax the syntax for this application * @param options the Options instance * @param autoUsage whether to print an automatically generated * usage statement */ public void printHelp(String cmdLineSyntax, Options options, boolean autoUsage) { printHelp(getWidth(), cmdLineSyntax, null, options, null, autoUsage); }
/** * Print the help for <code>options</code> with the specified * command line syntax. This method prints help information to * System.out. * * @param cmdLineSyntax the syntax for this application * @param header the banner to display at the beginning of the help * @param options the Options instance * @param footer the banner to display at the end of the help * @param autoUsage whether to print an automatically generated * usage statement */ public void printHelp(String cmdLineSyntax, String header, Options options, String footer, boolean autoUsage) { printHelp(getWidth(), cmdLineSyntax, header, options, footer, autoUsage); }
private String getUsageAsString() { StringWriter out = new StringWriter(); PrintWriter pw = new PrintWriter(out); helpFormatter.printUsage(pw, helpFormatter.getWidth(), "llap cluster", CLUSTER_OPTIONS); pw.flush(); return out.toString(); }
private String getUsageAsString() { StringWriter out = new StringWriter(); PrintWriter pw = new PrintWriter(out); helpFormatter.printUsage(pw, helpFormatter.getWidth(), "llap cache", CACHE_OPTIONS); pw.flush(); return out.toString(); }
private static void printUsage() { HelpFormatter hf = new HelpFormatter(); try { int width = hf.getWidth(); int jlineWidth = TerminalFactory.get().getWidth(); width = Math.min(160, Math.max(jlineWidth, width)); hf.setWidth(width); } catch (Throwable t) { // Ignore } hf.printHelp("metatool", OPTIONS); }
private void dumpUsage(PrintStream output) { final String cmdName = "dumpapp"; HelpFormatter formatter = new HelpFormatter(); output.println("Usage: " + cmdName + " [options] <plugin> [plugin-options]"); PrintWriter writer = new PrintWriter(output); try { formatter.printOptions( writer, formatter.getWidth(), mGlobalOptions.options, formatter.getLeftPadding(), formatter.getDescPadding()); } finally { writer.flush(); } } }
private static void printUsage() { HelpFormatter hf = new HelpFormatter(); try { int width = hf.getWidth(); int jlineWidth = TerminalFactory.get().getWidth(); width = Math.min(160, Math.max(jlineWidth, width)); hf.setWidth(width); } catch (Throwable t) { // Ignore } hf.printHelp("llapstatus", OPTIONS); }
private void printUsage() { HelpFormatter hf = new HelpFormatter(); try { int width = hf.getWidth(); int jlineWidth = TerminalFactory.get().getWidth(); width = Math.min(160, Math.max(jlineWidth, width)); // Ignore potentially incorrect values hf.setWidth(width); } catch (Throwable t) { // Ignore } hf.printHelp("llap", options); } }
@Override public void printUsage(String errorMessage) { output.println(); if (errorMessage != null) { output.println("ERROR: " + errorMessage); output.println(); } final PrintWriter printWriter = new PrintWriter(output); final int width = 80; final HelpFormatter hf = new HelpFormatter(); hf.setWidth(width); hf.printWrapped(printWriter, width, getDescription()); hf.printWrapped(printWriter, width, ""); if (isReferencable()) { hf.printWrapped(printWriter, width, "PRODUCES BACK-REFERENCES"); hf.printWrapped(printWriter, width, ""); } hf.printHelp(printWriter, hf.getWidth(), getName(), null, getOptions(), hf.getLeftPadding(), hf.getDescPadding(), null, false); printWriter.println(); printWriter.flush(); }
@Test public void testAccessors() { HelpFormatter formatter = new HelpFormatter(); formatter.setArgName("argname"); assertEquals("arg name", "argname", formatter.getArgName()); formatter.setDescPadding(3); assertEquals("desc padding", 3, formatter.getDescPadding()); formatter.setLeftPadding(7); assertEquals("left padding", 7, formatter.getLeftPadding()); formatter.setLongOptPrefix("~~"); assertEquals("long opt prefix", "~~", formatter.getLongOptPrefix()); formatter.setNewLine("\n"); assertEquals("new line", "\n", formatter.getNewLine()); formatter.setOptPrefix("~"); assertEquals("opt prefix", "~", formatter.getOptPrefix()); formatter.setSyntaxPrefix("-> "); assertEquals("syntax prefix", "-> ", formatter.getSyntaxPrefix()); formatter.setWidth(80); assertEquals("width", 80, formatter.getWidth()); }
/** * Print the help for <code>options</code> with the specified * command line syntax. This method prints help information to * System.out. * * @param cmdLineSyntax the syntax for this application * @param options the Options instance */ public void printHelp(String cmdLineSyntax, Options options) { printHelp(getWidth(), cmdLineSyntax, null, options, null, false); }
/** * Print the help for <code>options</code> with the specified * command line syntax. This method prints help information to * System.out. * * @param cmdLineSyntax the syntax for this application * @param options the Options instance * @param autoUsage whether to print an automatically generated * usage statement */ public void printHelp(String cmdLineSyntax, Options options, boolean autoUsage) { printHelp(getWidth(), cmdLineSyntax, null, options, null, autoUsage); }
/** * Print the help for <code>options</code> with the specified * command line syntax. This method prints help information to * System.out. * * @param cmdLineSyntax the syntax for this application * @param header the banner to display at the beginning of the help * @param options the Options instance * @param footer the banner to display at the end of the help * @param autoUsage whether to print an automatically generated * usage statement */ public void printHelp(String cmdLineSyntax, String header, Options options, String footer, boolean autoUsage) { printHelp(getWidth(), cmdLineSyntax, header, options, footer, autoUsage); }
private static void printHelpMessage(MigrationOptions options){ HelpFormatter helpFormatter = new HelpFormatter(); OutputStreamWriter outputStreamWriter = new OutputStreamWriter(System.out, Charset.defaultCharset()); PrintWriter printWriter = new PrintWriter(new BufferedWriter(outputStreamWriter)); int width = helpFormatter.getWidth(); int leftPadding = helpFormatter.getLeftPadding(); int descPadding = helpFormatter.getDescPadding(); helpFormatter.printHelp(printWriter, width, "graql migrate", null, options.getOptions(), leftPadding, descPadding, null); printWriter.flush(); }
public static void printHelp(PrintStream stream, String app) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(new PrintWriter(stream, true), formatter.getWidth(), app, HELP_HEADER, OPTIONS, formatter.getLeftPadding(), formatter.getDescPadding(), HELP_FOOTER, true); }
/** * Returns a help message, including the program usage and information about the arguments registered with the ArgumentParser. * * @return the usage information about the arguments registered with the ArgumentParser. */ public String getUsageInformation() { HelpFormatter formatter = new HelpFormatter(); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); formatter.printHelp(pw, formatter.getWidth(), applicationName, null, options, formatter.getLeftPadding(), formatter.getDescPadding(), null, false); pw.flush(); return sw.toString(); }
/** * Returns a help message, including the program usage and information about the arguments registered with the ArgumentParser. * * @return the usage information about the arguments registered with the ArgumentParser. */ public String getUsageInformation() { HelpFormatter formatter = new HelpFormatter(); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); formatter.printHelp(pw, formatter.getWidth(), applicationName, null, options, formatter.getLeftPadding(), formatter.getDescPadding(), null, false); pw.flush(); return sw.toString(); }
private void printUsage() { HelpFormatter hf = new HelpFormatter(); try { int width = hf.getWidth(); int jlineWidth = TerminalFactory.get().getWidth(); width = Math.min(160, Math.max(jlineWidth, width)); // Ignore potentially incorrect values hf.setWidth(width); } catch (Throwable t) { // Ignore } hf.printHelp("llap", options); } }
public static void printUsage() { HelpFormatter hf = new HelpFormatter(); try { int width = hf.getWidth(); int jlineWidth = TerminalFactory.get().getWidth(); width = Math.min(160, Math.max(jlineWidth, width)); // Ignore potentially incorrect values hf.setWidth(width); } catch (Throwable t) { // Ignore } LlapStatusOptionsProcessor optionsProcessor = new LlapStatusOptionsProcessor(); hf.printHelp(LLAPSTATUS_CONSTANT, optionsProcessor.options); }