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:com.opengamma.bbg.config.BloombergSecurityTypeDefinitionTool.java

@Override
protected void usage(Options options) {
    HelpFormatter formatter = new HelpFormatter();
    formatter.setWidth(120);
    formatter.printHelp("bbg-sec-type-defintion-tool.sh ...", options, true);
}

From source file:ch.cyberduck.cli.TerminalHelpPrinterTest.java

@Test
@Ignore//from  www.  ja  v a 2s . com
public void testPrintWidth20DefaultFormatter() throws Exception {
    final HelpFormatter f = new HelpFormatter();
    f.setWidth(20);
    TerminalHelpPrinter.print(TerminalOptionsBuilder.options(), f);
}

From source file:com.discursive.jccook.cmdline.CliUsageExample.java

private void printUsage() {
    HelpFormatter helpFormatter = new HelpFormatter();
    helpFormatter.setWidth(80);
    helpFormatter.printHelp(USAGE, HEADER, options, FOOTER, true);
}

From source file:com.zimbra.cs.mailclient.smtp.SmtpClient.java

private void usage() {
    HelpFormatter help = new HelpFormatter();
    help.setWidth(100);
    help.printHelp("zmjava " + getClass().getName() + " [OPTIONS] [HOSTNAME]", options);
}

From source file:ArgumentHandler.java

public void usage(String msg) {
    HelpFormatter helpFormatter = new HelpFormatter();
    helpFormatter.setWidth(80);
    helpFormatter.printHelp(syntax, msg + header, options, footer);
}

From source file:guru.nidi.ramlproxy.cli.OptionsParser.java

public void showHelp() {
    HelpFormatter formatter = new HelpFormatter();
    formatter.setWidth(80);
    formatter.setOptionComparator(optionComparator());
    formatter.printHelp("java -jar raml-tester-standalone.jar", helpHeader(), createOptions(), "", true);
}

From source file:com.opengamma.integration.server.copier.CommandLineOption.java

private void usage(final Options options, Class<?> entryPointClazz) {
    final HelpFormatter formatter = new HelpFormatter();
    formatter.setWidth(120);
    formatter.printHelp("java " + entryPointClazz.getName(), options, true);
}

From source file:de.elomagic.mag.MAG.java

private void printHelp() {
    HelpFormatter formatter = new HelpFormatter();
    formatter.setWidth(160);
    formatter.printHelp("mag", ApplicationProperties.getDisplayNameVersion(), options, "");
}

From source file:edu.umd.cloud9.example.hbase.HBaseWordCountFetch.java

/**
 * Runs this tool.// w  ww.j av  a2s. c o m
 */
@SuppressWarnings({ "static-access" })
public int run(String[] args) throws Exception {
    Options options = new Options();

    options.addOption(
            OptionBuilder.withArgName("table").hasArg().withDescription("HBase table name").create(TABLE));
    options.addOption(
            OptionBuilder.withArgName("word").hasArg().withDescription("word to look up").create(WORD));

    CommandLine cmdline;
    CommandLineParser parser = new GnuParser();

    try {
        cmdline = parser.parse(options, args);
    } catch (ParseException exp) {
        System.err.println("Error parsing command line: " + exp.getMessage());
        return -1;
    }

    if (!cmdline.hasOption(TABLE) || !cmdline.hasOption(WORD)) {
        System.out.println("args: " + Arrays.toString(args));
        HelpFormatter formatter = new HelpFormatter();
        formatter.setWidth(120);
        formatter.printHelp(this.getClass().getName(), options);
        ToolRunner.printGenericCommandUsage(System.out);
        return -1;
    }

    String tableName = cmdline.getOptionValue(TABLE);
    String word = cmdline.getOptionValue(WORD);

    Configuration conf = getConf();
    conf.addResource(new Path("/etc/hbase/conf/hbase-site.xml"));

    Configuration hbaseConfig = HBaseConfiguration.create(conf);
    HConnection hbaseConnection = HConnectionManager.createConnection(hbaseConfig);
    HTableInterface table = hbaseConnection.getTable(tableName);

    Get get = new Get(Bytes.toBytes(word));
    Result result = table.get(get);

    int count = Bytes.toInt(result.getValue(HBaseWordCount.CF, HBaseWordCount.COUNT));

    LOG.info("word: " + word + ", count: " + count);

    return 0;
}

From source file:edu.umd.shrawanraina.HBaseWordCountFetch.java

/**
 * Runs this tool.//from  w w w .  j a v a2  s  .  c o  m
 */
@SuppressWarnings({ "static-access" })
public int run(String[] args) throws Exception {
    Options options = new Options();

    options.addOption(
            OptionBuilder.withArgName("table").hasArg().withDescription("HBase table name").create(TABLE));
    options.addOption(
            OptionBuilder.withArgName("word").hasArg().withDescription("word to look up").create(WORD));

    CommandLine cmdline;
    CommandLineParser parser = new GnuParser();

    try {
        cmdline = parser.parse(options, args);
    } catch (ParseException exp) {
        System.err.println("Error parsing command line: " + exp.getMessage());
        return -1;
    }

    if (!cmdline.hasOption(TABLE) || !cmdline.hasOption(WORD)) {
        System.out.println("args: " + Arrays.toString(args));
        HelpFormatter formatter = new HelpFormatter();
        formatter.setWidth(120);
        formatter.printHelp(this.getClass().getName(), options);
        ToolRunner.printGenericCommandUsage(System.out);
        return -1;
    }

    String tableName = cmdline.getOptionValue(TABLE);
    String word = cmdline.getOptionValue(WORD);

    Configuration conf = getConf();
    conf.addResource(new Path("/etc/hbase/conf/hbase-site.xml"));

    Configuration hbaseConfig = HBaseConfiguration.create(conf);
    HConnection hbaseConnection = HConnectionManager.createConnection(hbaseConfig);
    HTableInterface table = hbaseConnection.getTable(tableName);

    Get get = new Get(Bytes.toBytes(word));
    Result result = table.get(get);

    int count = Bytes.toInt(result.getValue(HBaseWordCount.CF, HBaseWordCount.COUNT));

    LOG.info("word: " + word + ", count: " + count);
    LOG.info("word: " + word + ", result: " + result.getValue(HBaseWordCount.CF, HBaseWordCount.COUNT));
    return 0;
}