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:org.wikimedia.analytics.kraken.funnel.cli.Cli.java

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

From source file:org.wikimedia.analytics.storm.Cli.java

/**
 *
 * @param options//w ww  .ja  v  a  2  s  .  c o  m
 */
private static void printUsage(final Options options) {
    HelpFormatter helpFormatter = new HelpFormatter();
    helpFormatter.setWidth(90);
    helpFormatter.printHelp(HEADER, USAGE, options, FOOTER);
}

From source file:org.wildfly.security.tool.CredentialStoreCommand.java

/**
 * Display help to the command./* ww w. ja v  a2  s. c  o  m*/
 */
@Override
public void help() {
    HelpFormatter help = new HelpFormatter();
    help.setWidth(WIDTH);
    help.printHelp(ElytronToolMessages.msg.cmdHelp(getToolCommand(), CREDENTIAL_STORE_COMMAND),
            ElytronToolMessages.msg.cmdLineCredentialStoreHelpHeader(), options, "", true);
}

From source file:org.wildfly.security.tool.FileSystemRealmCommand.java

/**
 * Displays the help for the command//from  www. j a va  2 s . co  m
 */
@Override
public void help() {
    HelpFormatter help = new HelpFormatter();
    help.setWidth(WIDTH);
    help.printHelp(ElytronToolMessages.msg.cmdHelp(getToolCommand(), FILE_SYSTEM_REALM_COMMAND),
            ElytronToolMessages.msg.cmdFileSystemRealmHelpHeader(), options, "", true);
}

From source file:org.wildfly.security.tool.MaskCommand.java

/**
 * Display help to the command./* w  w w.  j  a  v a  2s.  c  om*/
 */
@Override
public void help() {
    HelpFormatter help = new HelpFormatter();
    help.setWidth(WIDTH);
    help.printHelp(ElytronToolMessages.msg.cmdHelp(getToolCommand(), MASK_COMMAND),
            ElytronToolMessages.msg.cmdMaskHelpHeader(), options, "", true);
}

From source file:org.wildfly.security.tool.VaultCommand.java

/**
 * Display help to the command.//from   ww w  . j av a  2 s.co m
 */
@Override
public void help() {
    HelpFormatter help = new HelpFormatter();
    help.setWidth(WIDTH);
    help.printHelp(ElytronToolMessages.msg.cmdHelp(getToolCommand(), VAULT_COMMAND),
            ElytronToolMessages.msg.cmdVaultHelpHeader(), options, "", true);
}

From source file:pl.nask.hsn2.unicorn.CommandLineParams.java

private void parseParams(String[] args) {
    try {// w  ww.  ja  v a  2s . c  om
        this.cmd = new PosixParser().parse(options, args);
        if (cmd.hasOption("help")) {
            HelpFormatter formatter = new HelpFormatter();
            formatter.setWidth(110);
            formatter.printHelp("java -jar ...", options);
            System.exit(0);
        }
        if (cmd.hasOption("sa")) {
            address = cmd.getOptionValue("sa");
        }
        if (cmd.hasOption("qn")) {
            osQueueName = cmd.getOptionValue("qn");
        }
        if (cmd.hasOption("fqn")) {
            frameworkQueueName = cmd.getOptionValue("fqn");
        }
        if (cmd.hasOption("verb")) {
            verbose = true;
        }
        if (cmd.hasOption("b")) {
            brief = true;
        }
        if (cmd.hasOption("dump")) {
            dump = true;
        }

    } catch (ParseException e) {
        System.err.println(e.getMessage());
        System.exit(-1);
    }
}

From source file:pt.haslab.dude.Tool.java

public static void main(String[] args) {
    Options options = new Options();
    options.addOption("s", "minshare", true, "threshold for similarity (% of file sizes, default=10)");
    options.addOption("c", "minchunk", true, "minimum chunk considered (# of bytes, default=10)");
    options.addOption("g", "graph", false, "output in GraphViz (.dot) format (>2 files)");
    options.addOption("d", "detail", false, "show common text found");

    try {/*from   w  ww.  j av a  2s  .  com*/
        int minchunk = 10, minshare = 10;
        boolean graph = false, detail = false;

        CommandLineParser parser = new BasicParser();
        CommandLine cmd = parser.parse(options, args);

        if (cmd.hasOption('s'))
            minshare = Integer.parseInt(cmd.getOptionValue('s'));
        if (cmd.hasOption('c'))
            minchunk = Integer.parseInt(cmd.getOptionValue('c'));
        if (cmd.hasOption('g'))
            graph = true;
        if (cmd.hasOption('d'))
            detail = true;

        String[] files = cmd.getArgs();

        if (files.length < 2)
            throw new ParseException("I need at least two files");

        if (files.length == 2 && graph)
            throw new ParseException("need >2 files to output graph");

        if (files.length > 2 && detail)
            throw new ParseException("detail shown only for 2 files");

        Polynomial polynomial = Polynomial.createIrreducible(53);

        List<FileInfo> bigger = new ArrayList<FileInfo>();
        for (String s : files)
            bigger.add(new FileInfo(s, bigger, polynomial, detail, minchunk, minshare));

        for (FileInfo fi : bigger) {
            fi.compute();
            if (!detail && !graph)
                fi.dumpSummary(System.out);
        }

        if (graph) {
            System.out.println("graph dupls {");
            for (FileInfo fi : bigger)
                fi.dumpEdges(System.out);
            System.out.println("}");
        }

        return;
    } catch (ParseException e) {
        System.err.println("invalid options: " + e.getMessage());
    } catch (FileNotFoundException e) {
        System.err.println(e.getMessage());
    } catch (IOException e) {
        System.err.println(e.getMessage());
    }

    HelpFormatter formatter = new HelpFormatter();
    formatter.setWidth(78);
    formatter.printHelp("java -jar dude.jar [options] file1 file2 [ ... fileN ]",
            "DuDe is a duplication detector for text files.", options,
            "For more information: http://github.com/jopereira/dude");
}

From source file:scalabilityTests.scenarios.SchedulerJobSubmission.java

private static void printHelp(Options options) {
    HelpFormatter hf = new HelpFormatter();
    hf.setWidth(160);
    hf.printHelp(COMMAND_NAME, options, true);
}

From source file:scoutdoc.main.Main.java

private static void printHelpAndExit(Options options) {
    HelpFormatter helpFormatter = new HelpFormatter();
    helpFormatter.setWidth(200);
    helpFormatter.setOptionComparator(new Comparator<Option>() {

        @Override//from  www . ja  v a2  s .  c  o  m
        public int compare(Option opt1, Option opt2) {
            return ComparisonChain.start()
                    .compare(opt1.getOpt(), opt2.getOpt(),
                            Ordering.explicit(HELP_ID, PROP_ID, SOURCE_TASKS_ID, SOURCE_ALL_PAGES_ID,
                                    SOURCE_LIST_ID, SOURCE_RECENT_CHANGES_ID, SOURCE_RSS_ID, SOURCE_FILTER_ID,
                                    OPERATION_ID, OUTPUT_CHECKSTYLE_ID, OUTPUT_DASHBOARD_ID))
                    .result();
        }
    });
    helpFormatter.printHelp("scoutdoc.main.Main", options);
    System.exit(1);
}