Example usage for org.apache.commons.cli HelpFormatter setWidth

List of usage examples for org.apache.commons.cli HelpFormatter setWidth

Introduction

In this page you can find the example usage for org.apache.commons.cli HelpFormatter setWidth.

Prototype

public void setWidth(int width) 

Source Link

Document

Sets the 'width'.

Usage

From source file:edu.vt.cs.irwin.etdscraper.Configuration.java

public static Configuration setup(String[] args) {
    INSTANCE = new Configuration(args);
    if (INSTANCE.displayHelp) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.setWidth(100);
        formatter.printHelp("etd-scraper", options);
        return null;
    }//from   ww w.ja  va2s  .com
    logger.info("Using jdbc URL: " + INSTANCE.getJdbcUrl());
    return INSTANCE;
}

From source file:com.asakusafw.yaess.tools.GenerateExecutionId.java

static int execute(String[] args) {
    assert args != null;
    Configuration conf;//from   w  ww . j a  v  a2  s . co  m
    try {
        conf = parseConfiguration(args);
    } catch (Exception e) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.setWidth(Integer.MAX_VALUE);
        formatter.printHelp(
                MessageFormat.format("java -classpath ... {0}", GenerateExecutionId.class.getName()), OPTIONS,
                true);
        e.printStackTrace(System.out);
        return 1;
    }
    try {
        String executionId = computeExecutionId(conf);
        System.out.print(executionId);
    } catch (Exception e) {
        e.printStackTrace();
        return 1;
    }
    return 0;
}

From source file:com.basistech.ninja.Train.java

private static void usage(Options options) {
    HelpFormatter formatter = new HelpFormatter();
    formatter.setWidth(80);
    formatter.printHelp("Train [options]", options);
    System.out.println();// ww  w.j  av a 2 s  .  com
}

From source file:com.asakusafw.yaess.tools.Explain.java

static int execute(String[] args) {
    assert args != null;
    Configuration conf;/*from   w ww.j  a  va2s  .  co m*/
    try {
        conf = parseConfiguration(args);
    } catch (Exception e) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.setWidth(Integer.MAX_VALUE);
        formatter.printHelp(MessageFormat.format("java -classpath ... {0}", Explain.class.getName()), OPTIONS,
                true);
        e.printStackTrace(System.out);
        return 1;
    }
    try {
        explainBatch(conf.script);
    } catch (Exception e) {
        e.printStackTrace();
        return 1;
    }
    return 0;
}

From source file:com.asakusafw.windgate.bootstrap.WindGateAbort.java

static int execute(String[] args) {
    AbortTask task;/* w  ww  .  j  av a 2 s  . c om*/
    try {
        Configuration conf = parseConfiguration(args);
        task = new AbortTask(conf.profile, conf.sessionId);
    } catch (Exception e) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.setWidth(Integer.MAX_VALUE);
        formatter.printHelp(MessageFormat.format("java -classpath ... {0}", WindGateAbort.class.getName()),
                OPTIONS, true);
        System.out.println("Note:");
        System.out.println("  If session ID is not specified, this removes all sessions");
        System.out.println("");
        System.out.println("  Profile path accepts following URI formats:");
        System.out.println("    no scheme -");
        System.out.println("      Local file system path");
        System.out.println("    \"classpath\" scheme -");
        System.out.println("      Absolute path on class path (includes plugin libraries)");
        System.out.println("    other schemes (e.g. http://...)-");
        System.out.println("      Processed as a URL");
        WGLOG.error(e, "E01001");
        return 1;
    }
    try {
        if (RuntimeContext.get().canExecute(task)) {
            task.execute();
        }
        return 0;
    } catch (Exception e) {
        WGLOG.error(e, "E01002");
        return 1;
    }
}

From source file:com.asakusafw.testdriver.tools.runner.BatchTestCollector.java

/**
 * Program entry.//from  w w  w  .j  a  v  a2 s .  c  o  m
 * @param args program arguments
 * @return the exit code
 */
public static int execute(String[] args) {
    Conf conf;
    try {
        conf = parseArguments(args);
    } catch (Exception e) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.setWidth(Integer.MAX_VALUE);
        formatter.printHelp(MessageFormat.format("java -classpath ... {0}", //$NON-NLS-1$
                BatchTestRunner.class.getName()), OPTIONS, true);
        LOG.error(MessageFormat.format(Messages.getString("BatchTestCollector.errorInvalidArgument"), //$NON-NLS-1$
                Arrays.toString(args)), e);
        return 1;
    }
    try {
        BatchTestCollector preparator = new BatchTestCollector(conf.context);
        preparator.collect(conf.exporter, conf.output);
        return 0;
    } catch (Exception e) {
        LOG.error(MessageFormat.format(Messages.getString("BatchTestCollector.errorFailedToCollectOutput"), //$NON-NLS-1$
                Arrays.toString(args)), e);
        return 1;
    }
}

From source file:com.asakusafw.testdriver.tools.runner.BatchTestPreparator.java

/**
 * Program entry./*from  w w w  .  jav a 2 s.  c  o m*/
 * @param args program arguments
 * @return the exit code
 */
public static int execute(String[] args) {
    Conf conf;
    try {
        conf = parseArguments(args);
    } catch (Exception e) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.setWidth(Integer.MAX_VALUE);
        formatter.printHelp(MessageFormat.format("java -classpath ... {0}", //$NON-NLS-1$
                BatchTestRunner.class.getName()), OPTIONS, true);
        LOG.error(MessageFormat.format(Messages.getString("BatchTestPreparator.errorInvalidArgument"), //$NON-NLS-1$
                Arrays.toString(args)), e);
        return 1;
    }
    try {
        BatchTestPreparator preparator = new BatchTestPreparator(conf.context);
        preparator.prepare(conf.importer, conf.data);
        return 0;
    } catch (Exception e) {
        LOG.error(MessageFormat.format(Messages.getString("BatchTestPreparator.errorFailedToPrepareInput"), //$NON-NLS-1$
                Arrays.toString(args)), e);
        return 1;
    }
}

From source file:com.google.flightmap.parsing.faa.nasr.AirspaceParser.java

private static void printHelp(final CommandLine line) {
    final HelpFormatter formatter = new HelpFormatter();
    formatter.setWidth(100);
    formatter.printHelp("AirspaceParser", OPTIONS, true);
}

From source file:net.adamjak.thomas.graph.application.cli.CliManager.java

/**
 * Print CLI help message// ww w .ja v  a 2s.c  om
 */
public static void printHelp() {
    String example = "\nExample: java -jar app.jar -i graphs.g6 -o results.csv -t ONE_ALGORITHM -l 100\n\n";

    HelpFormatter formatter = new HelpFormatter();
    formatter.setWidth(90);
    formatter.printHelp("java -jar /path/to/application.jar [OPTIONS...]", example, CliManager.getOptions(),
            "");
}

From source file:edu.umass.cs.gnsserver.utils.ParametersAndOptions.java

/**
 * Prints the usage string./*from  www.j av  a 2 s. c  o m*/
 *
 * @param className
 * @param commandLineOptions
 */
public static void printUsage(String className, Options commandLineOptions) {
    HelpFormatter helpFormatter = new HelpFormatter();
    helpFormatter.setWidth(135);
    helpFormatter.printHelp("java -cp GNS.jar " + className, HELP_HEADER, commandLineOptions, HELP_FOOTER);
}