List of usage examples for org.apache.commons.cli HelpFormatter getDescPadding
public int getDescPadding()
From source file:com.zimbra.cs.service.authenticator.CertUtil.java
private static void usage(Options options) { System.out.println("\n"); PrintWriter pw = new PrintWriter(System.out, true); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(pw, formatter.getWidth(), "zmjava " + CertUtil.class.getCanonicalName() + " [options]", null, options, formatter.getLeftPadding(), formatter.getDescPadding(), null); System.out.println("\n"); pw.flush();//from w ww.ja v a 2 s .c om }
From source file:com.emc.ecs.sync.cli.CliHelper.java
public static String longHelp() { StringWriter helpWriter = new StringWriter(); PrintWriter pw = new PrintWriter(helpWriter); HelpFormatter fmt = new HelpFormatter(); fmt.setWidth(79);/*from w w w . ja va 2s. co m*/ // main CLI options Options options = ConfigUtil.wrapperFor(CliConfig.class).getOptions(); // sync options for (Option o : ConfigUtil.wrapperFor(SyncOptions.class).getOptions().getOptions()) { options.addOption(o); } // Make sure we do CommonOptions first String usage = "java -jar ecs-sync.jar -source <source-uri> [-filters <filter1>[,<filter2>,...]] -target <target-uri> [options]"; fmt.printHelp(pw, fmt.getWidth(), usage, "Common options:", options, fmt.getLeftPadding(), fmt.getDescPadding(), null); pw.print("\nAvailable plugins are listed below along with any custom options they may have\n"); // Do the rest for (ConfigWrapper<?> storageWrapper : ConfigUtil.allStorageConfigWrappers()) { pw.write('\n'); pw.write(String.format("%s (%s)\n", storageWrapper.getLabel(), storageWrapper.getUriPrefix())); fmt.printWrapped(pw, fmt.getWidth(), 4, " " + storageWrapper.getDocumentation()); fmt.printWrapped(pw, fmt.getWidth(), 4, " NOTE: Storage options must be prefixed by source- or target-, depending on which role they assume"); fmt.printOptions(pw, fmt.getWidth(), storageWrapper.getOptions(), fmt.getLeftPadding(), fmt.getDescPadding()); } for (ConfigWrapper<?> filterWrapper : ConfigUtil.allFilterConfigWrappers()) { pw.write('\n'); pw.write(String.format("%s (%s)\n", filterWrapper.getLabel(), filterWrapper.getCliName())); fmt.printWrapped(pw, fmt.getWidth(), 4, " " + filterWrapper.getDocumentation()); fmt.printOptions(pw, fmt.getWidth(), filterWrapper.getOptions(), fmt.getLeftPadding(), fmt.getDescPadding()); } return helpWriter.toString(); }
From source file:ai.grakn.graql.GraqlShell.java
private static void printUsage(Options options, String footer) { 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.sh", null, options, leftPadding, descPadding, footer); printWriter.flush();/* w w w . j a va 2 s . c o m*/ }
From source file:com.msbmsb.genealogeo.ui.cli.GenealoGeoCLI.java
/** * Display usage message/*from ww w . j av a 2 s. c o m*/ */ public void usage(String msg) { HelpFormatter hf = new HelpFormatter(); PrintWriter pw = new PrintWriter(System.err); hf.setSyntaxPrefix("Usage: "); hf.printHelp(pw, hf.getWidth(), this.usage, null, this.opts, hf.getLeftPadding(), hf.getDescPadding(), msg, false); pw.flush(); System.exit(1); }
From source file:com.zimbra.common.calendar.ZoneInfo2iCalendar.java
private static void usage(String errmsg) { if (errmsg != null) { System.err.println(errmsg); }// ww w . j a v a 2 s. c o m String usage = "zmtzdata2ical <options> [tzdata source files ...]"; Options opts = sOptions; PrintWriter pw = new PrintWriter(System.err, true); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(pw, formatter.getWidth(), usage, null, opts, formatter.getLeftPadding(), formatter.getDescPadding(), null); pw.flush(); }
From source file:net.freifunk.autodeploy.ui.commandline.CommandLineParserImpl.java
@Override public String getHelpText() { final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); final PrintWriter writer = new PrintWriter(outputStream); final HelpFormatter helpFormatter = new HelpFormatter(); helpFormatter.printHelp(writer, helpFormatter.getWidth(), "ff-autodeploy", null, // no header createOptions(), helpFormatter.getLeftPadding(), helpFormatter.getDescPadding(), null, // no footer false // no auto usage );/*from www. ja va 2s . com*/ writer.flush(); return new String(outputStream.toByteArray()); }
From source file:com.zimbra.cs.db.JdbcClient.java
private void usage(ParseException e) { if (e != null) { System.err.println(e + "\n"); }//w ww. jav a 2s. c o m PrintWriter pw = new PrintWriter(System.err, true); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(pw, formatter.getWidth(), "zmsql <options>", null, mOptions, formatter.getLeftPadding(), formatter.getDescPadding(), ""); }
From source file:grakn.core.console.GraknConsole.java
private void printHelp(PrintStream sout) { HelpFormatter formatter = new HelpFormatter(); OutputStreamWriter writer = new OutputStreamWriter(sout, Charset.defaultCharset()); PrintWriter printer = new PrintWriter(new BufferedWriter(writer)); formatter.printHelp(printer, formatter.getWidth(), "grakn console [options]", null, options, formatter.getLeftPadding(), formatter.getDescPadding(), null); printer.flush();/* w ww .j a v a 2 s .c o m*/ }
From source file:ai.grakn.migration.base.io.MigrationCLI.java
private void printHelpMessage() { HelpFormatter helpFormatter = new HelpFormatter(); PrintWriter printWriter = new PrintWriter(System.out); int width = helpFormatter.getWidth(); int leftPadding = helpFormatter.getLeftPadding(); int descPadding = helpFormatter.getDescPadding(); helpFormatter.printHelp(printWriter, width, "migration.sh", null, defaultOptions, leftPadding, descPadding, null);//from w w w . ja va 2s . c o m printWriter.flush(); }
From source file:com.facebook.stetho.dumpapp.Dumper.java
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 {/* w w w .ja v a2 s . c o m*/ formatter.printOptions(writer, formatter.getWidth(), mGlobalOptions.options, formatter.getLeftPadding(), formatter.getDescPadding()); } finally { writer.flush(); } }