List of usage examples for org.apache.commons.cli HelpFormatter setSyntaxPrefix
public void setSyntaxPrefix(String prefix)
From source file:nl.cyso.vsphere.client.docs.Readme.java
private String getSynopsisSection() { StringBuilder section = new StringBuilder(); section.append("SYNOPSIS\n"); section.append("--------\n"); HelpFormatter help = new HelpFormatter(); help.setSyntaxPrefix(""); Writer str = new StringWriter(); PrintWriter pw = new PrintWriter(str); help.printUsage(pw, 1000, Version.getVersion().getProjectName(), ConfigModes.getMode("ROOT")); section.append("\t\n\t" + str.toString() + "\n"); for (String m : ConfigModes.getModes().keySet()) { if (m == "ROOT") { continue; }//from w ww .j a va 2 s. co m str = new StringWriter(); pw = new PrintWriter(str); help.printUsage(pw, 1000, Version.getVersion().getProjectName(), ConfigModes.getMode(m)); section.append(String.format("**%s**\n\n", m.toString())); section.append("\t" + str.toString() + "\n"); } return section.toString(); }
From source file:nl.nekoconeko.configmode.ConfigModes.java
public static void printAllHelp() { HelpFormatter format = new HelpFormatter(); for (String mode : ConfigModes.getModes().keySet()) { format.setSyntaxPrefix(String.format("%s mode: ", mode.toString())); format.printHelp(ConfigModes.version.getProjectName(), ConfigModes.getMode(mode), true); }/* www . ja v a 2s . c o m*/ }
From source file:nl.nekoconeko.configmode.ConfigModes.java
public static void printConfigModeHelp(String mode) { HelpFormatter format = new HelpFormatter(); if (!mode.equalsIgnoreCase("root")) { format.setSyntaxPrefix(String.format("Usage for %s mode: ", mode.toString())); }//from www . ja va 2 s . c o m format.printHelp(ConfigModes.version.getProjectName(), ConfigModes.getMode(mode), true); }
From source file:org.apache.flink.client.cli.CliFrontendParser.java
public static void printHelpForRun() { HelpFormatter formatter = new HelpFormatter(); formatter.setLeftPadding(5);//from ww w . ja v a2s . c om formatter.setWidth(80); System.out.println("\nAction \"run\" compiles and runs a program."); System.out.println("\n Syntax: run [OPTIONS] <jar-file> <arguments>"); formatter.setSyntaxPrefix(" \"run\" action options:"); formatter.printHelp(" ", getRunOptionsWithoutDeprecatedOptions(new Options())); printCustomCliOptions(formatter, true); System.out.println(); }
From source file:org.apache.flink.client.cli.CliFrontendParser.java
public static void printHelpForInfo() { HelpFormatter formatter = new HelpFormatter(); formatter.setLeftPadding(5);/*from w w w.ja v a2s . c o m*/ formatter.setWidth(80); System.out.println("\nAction \"info\" shows the optimized execution plan of the program (JSON)."); System.out.println("\n Syntax: info [OPTIONS] <jar-file> <arguments>"); formatter.setSyntaxPrefix(" \"info\" action options:"); formatter.printHelp(" ", getInfoOptionsWithoutDeprecatedOptions(new Options())); printCustomCliOptions(formatter, false); System.out.println(); }
From source file:org.apache.flink.client.cli.CliFrontendParser.java
public static void printHelpForList() { HelpFormatter formatter = new HelpFormatter(); formatter.setLeftPadding(5);/*www. j a va 2s . com*/ formatter.setWidth(80); System.out.println("\nAction \"list\" lists running and scheduled programs."); System.out.println("\n Syntax: list [OPTIONS]"); formatter.setSyntaxPrefix(" \"list\" action options:"); formatter.printHelp(" ", getListOptionsWithoutDeprecatedOptions(new Options())); printCustomCliOptions(formatter, false); System.out.println(); }
From source file:org.apache.flink.client.cli.CliFrontendParser.java
public static void printHelpForStop() { HelpFormatter formatter = new HelpFormatter(); formatter.setLeftPadding(5);//from w w w . j a v a2 s.c om formatter.setWidth(80); System.out.println("\nAction \"stop\" stops a running program (streaming jobs only)."); System.out.println("\n Syntax: stop [OPTIONS] <Job ID>"); formatter.setSyntaxPrefix(" \"stop\" action options:"); formatter.printHelp(" ", getStopOptionsWithoutDeprecatedOptions(new Options())); printCustomCliOptions(formatter, false); System.out.println(); }
From source file:org.apache.flink.client.cli.CliFrontendParser.java
public static void printHelpForCancel() { HelpFormatter formatter = new HelpFormatter(); formatter.setLeftPadding(5);/*from w w w .j a va 2s . com*/ formatter.setWidth(80); System.out.println("\nAction \"cancel\" cancels a running program."); System.out.println("\n Syntax: cancel [OPTIONS] <Job ID>"); formatter.setSyntaxPrefix(" \"cancel\" action options:"); formatter.printHelp(" ", getCancelOptionsWithoutDeprecatedOptions(new Options())); printCustomCliOptions(formatter, false); System.out.println(); }
From source file:org.apache.flink.client.cli.CliFrontendParser.java
public static void printHelpForSavepoint() { HelpFormatter formatter = new HelpFormatter(); formatter.setLeftPadding(5);/*from w w w. ja v a 2 s. c om*/ formatter.setWidth(80); System.out .println("\nAction \"savepoint\" triggers savepoints for a running job or disposes existing ones."); System.out.println("\n Syntax: savepoint [OPTIONS] <Job ID> [<target directory>]"); formatter.setSyntaxPrefix(" \"savepoint\" action options:"); formatter.printHelp(" ", getSavepointOptionsWithoutDeprecatedOptions(new Options())); printCustomCliOptions(formatter, false); System.out.println(); }
From source file:org.apache.flink.client.cli.CliFrontendParser.java
/** * Prints custom cli options//from w ww .ja va2 s. co m * @param formatter The formatter to use for printing * @param runOptions True if the run options should be printed, False to print only general options */ private static void printCustomCliOptions(HelpFormatter formatter, boolean runOptions) { // prints options from all available command-line classes for (CustomCommandLine cli : CliFrontend.getCustomCommandLineList()) { if (cli.getId() != null) { formatter.setSyntaxPrefix(" Options for " + cli.getId() + " mode:"); Options customOpts = new Options(); cli.addGeneralOptions(customOpts); if (runOptions) { cli.addRunOptions(customOpts); } formatter.printHelp(" ", customOpts); System.out.println(); } } }