List of usage examples for org.apache.commons.cli HelpFormatter setWidth
public void setWidth(int width)
From source file:com.sindicetech.siren.demo.loader.Loader.java
private static void showExtendHelpExit(Options options) { System.out.println("Loader" + DESCRIPTION); HelpFormatter hf = new HelpFormatter(); hf.setWidth(100); hf.printHelp(USAGE_BASE + "<opts>", options); System.out.println("\nNote: only file or directory names option is mandatory\n" + "Examples:\n" + " " + USAGE_BASE + " -" + INPUT_FILE_OPT + " file.json export-folder\n" + " " + USAGE_BASE + " -" + BATCH_OPT + " " + 128 + " -" + INPUT_FILE_OPT + " file.json\n" + " " + USAGE_BASE + " -" + NO_EXT_CHECK_OPT + " export-directory\n"); System.exit(0);/*w w w . j a va 2 s . c om*/ }
From source file:cc.redpen.Main.java
private static void printHelp(Options opt) { HelpFormatter formatter = new HelpFormatter(); formatter.setWidth(100); PrintWriter pw = new PrintWriter(System.err); formatter.printHelp(pw, 80, PROGRAM + " [Options] [<INPUT FILE>]", HELP_HEADER, opt, 1, 3, HELP_FOOTER); pw.flush();/*from ww w.j a v a 2 s . com*/ }
From source file:com.esri.geoevent.test.performance.ProducerMain.java
private static void printHelp(Options performerOptions) { HelpFormatter formatter = new HelpFormatter(); formatter.setLongOptPrefix("-"); formatter.setArgName("value"); formatter.setWidth(100); // do not sort the options in any order formatter.setOptionComparator(new Comparator<Option>() { @Override//w w w. j a v a2 s . c o m public int compare(Option o1, Option o2) { return 0; } }); formatter.printHelp(ImplMessages.getMessage("PRODUCER_EXECUTOR_HELP_TITLE_MSG"), performerOptions, true); System.out.println(""); }
From source file:edu.usc.leqa.Main.java
/** * Parses the inputs.//from w w w . j ava 2 s. c om * * @param args the args */ @SuppressWarnings("static-access") public static void parseInputs(String[] args) { Options options = new Options(); options.addOption( OptionBuilder.withLongOpt("input").withDescription("QASM/TFC input file (QASM is preferred)") .isRequired().hasArg().withArgName("file").create("i")); options.addOption(OptionBuilder.withLongOpt("fabric").withDescription("Fabric specification file") .isRequired().hasArg().withArgName("file").create("f")); options.addOption(OptionBuilder.withLongOpt("technology").withDescription("Technology file").isRequired() .hasArg().withArgName("file").create("t")); options.addOption(OptionBuilder.withLongOpt("speed").withDescription("Qubit movement speed").isRequired() .hasArg().withArgName("num").create("s")); options.addOption(OptionBuilder.withLongOpt("skip").withDescription("Skip invocation of QSPR").create("j")); options.addOption(OptionBuilder.withLongOpt("verbose") .withDescription("Verbosely prints the quantum operations").create("v")); options.addOption(OptionBuilder.withLongOpt("debug").withDescription("Print debugging info").create("d")); options.addOption(OptionBuilder.withLongOpt("help").withDescription("Print this help menu").create("h")); CommandLineParser parser = new GnuParser(); CommandLine cmd = null; try { cmd = parser.parse(options, args); } catch (ParseException e) { System.err.println(e.getMessage()); // automatically generate the help statement HelpFormatter formatter = new HelpFormatter(); formatter.setWidth(80); formatter.printHelp("leqa", "LEQA estimates the latency of a given QASM/TFC " + "mapped to a given PMD fabric.", options, "", true); System.exit(-1); } inputFileAddr = cmd.getOptionValue("input"); if (!new File(inputFileAddr).exists()) { System.err.println("Input file " + inputFileAddr + " does not exist."); System.exit(-1); } else if (!new File(inputFileAddr).setReadable(true)) { System.err.println("Input file " + inputFileAddr + " does not have read permission."); System.exit(-1); } fabricFileAddr = cmd.getOptionValue("fabric"); if (!new File(fabricFileAddr).exists()) { System.err.println("Fabric file " + fabricFileAddr + " does not exist."); System.exit(-1); } else if (!new File(fabricFileAddr).setReadable(true)) { System.err.println("Fabric file " + inputFileAddr + " does not have read permission."); System.exit(-1); } techFileAddr = cmd.getOptionValue("technology"); if (!new File(techFileAddr).exists()) { System.err.println("Technology file " + techFileAddr + " does not exist."); System.exit(-1); } else if (!new File(techFileAddr).setReadable(true)) { System.err.println("Technology file " + inputFileAddr + " does not have read permission."); System.exit(-1); } speed = Double.parseDouble(cmd.getOptionValue("speed")); if (cmd.hasOption("skip")) { RuntimeConfig.SKIP = true; } else { RuntimeConfig.SKIP = false; } if (cmd.hasOption("debug")) { RuntimeConfig.DEBUG = true; } else { RuntimeConfig.DEBUG = false; } if (cmd.hasOption("verbose")) { RuntimeConfig.VERBOSE = true; } else { RuntimeConfig.VERBOSE = false; } }
From source file:com.google.api.ads.adwords.jaxws.extensions.kratu.KratuMain.java
/** * Prints the help message.//from www .ja va 2 s . c o m * * @param options the options available for the user. */ private static void printHelpMessage(Options options) { // automatically generate the help statement System.out.println(); HelpFormatter formatter = new HelpFormatter(); formatter.setWidth(120); formatter.printHelp("java -Xmx4G -jar kratubackend.jar -startDate YYYYMMDD -endDate YYYYMMDD -file <file>\n" + "-Xmx4G -jar kratubackend.jar -processKratus -startDate YYYYMMDD -endDate YYYYMMDD -file <file>\n" + "-Xmx4G -jar kratubackend.jar -startServer -file <file>\n", options); printSamplePropertiesFile(); System.out.println(); }
From source file:com.asakusafw.lang.inspection.cli.Cli.java
/** * The program entry.//from w w w.j a v a 2 s.c o m * @param args application arguments * @return the exit code */ public static int execute(String... args) { Configuration configuration; try { configuration = parse(args); } catch (Exception e) { LOG.error(MessageFormat.format("error occurred while analyzing arguments: {0}", Arrays.toString(args)), e); HelpFormatter formatter = new HelpFormatter(); formatter.setWidth(Integer.MAX_VALUE); formatter.printHelp(MessageFormat.format("java -classpath ... {0}", //$NON-NLS-1$ Cli.class.getName()), new Opts().options, true); return 1; } try { process(configuration); } catch (Exception e) { LOG.error(MessageFormat.format("error occurred while processing inspection object: {0}", Arrays.toString(args)), e); return 1; } return 0; }
From source file:com.google.api.ads.adwords.awalerting.AwAlerting.java
/** * Prints the help message./* w w w .j a v a 2s. co m*/ * * @param options the options available for the user */ private static void printHelpMessage(Options options) { // automatically generate the help statement HelpFormatter formatter = new HelpFormatter(); formatter.setWidth(120); formatter.printHelp("\n java -Xmx1G -jar aw-alerting.jar -file <file>", "\nArguments:", options, ""); System.out.println(); }
From source file:at.favre.tools.dconvert.ui.CLIInterpreter.java
private static void printHelp(Options options) { HelpFormatter help = new HelpFormatter(); help.setWidth(110); help.setLeftPadding(4);/*from w w w.j a v a 2 s. com*/ help.printHelp("converter", "version: " + CLIInterpreter.class.getPackage().getImplementationVersion(), options, "", true); }
From source file:com.opengamma.bbg.loader.BloombergSecurityFileLoader.java
private static void usage(Options options) { HelpFormatter formatter = new HelpFormatter(); formatter.setWidth(120); formatter.printHelp("java " + BloombergSecurityFileLoader.class.getName() + " [options]... [files]...", options);/*from ww w . j av a 2s . co m*/ }
From source file:com.puppycrawl.tools.checkstyle.JavadocPropertiesGenerator.java
/** * Prints the usage information.//from www .j a v a 2 s . c o m */ private static void printUsage() { final HelpFormatter formatter = new HelpFormatter(); formatter.setWidth(HELP_WIDTH); formatter.printHelp( String.format("java %s [options] <input file>.", JavadocPropertiesGenerator.class.getName()), buildOptions()); }