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.apkTool.Main.java

private static void usage() {
    // load basicOptions
    _Options();/*  w w w. ja v  a 2s .co  m*/
    HelpFormatter formatter = new HelpFormatter();
    formatter.setWidth(120);

    // print out license info prior to formatter.
    System.out.println("Apktool v" + Androlib.getVersion() + " - a tool for reengineering Android apk files\n"
            + "with smali v" + ApktoolProperties.get("smaliVersion") + " and baksmali v"
            + ApktoolProperties.get("baksmaliVersion") + "\n"
            + "Copyright 2014 Ryszard Winiewski <brut.alll@gmail.com>\n"
            + "Updated by Connor Tumbleson <connor.tumbleson@gmail.com>");
    if (isAdvanceMode()) {
        System.out.println("Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)\n");
    } else {
        System.out.println("");
    }

    // 4 usage outputs (general, frameworks, decode, build)
    formatter.printHelp("apktool " + verbosityHelp(), normalOptions);
    formatter.printHelp("apktool " + verbosityHelp() + "if|install-framework [options] <framework.apk>",
            frameOptions);
    formatter.printHelp("apktool " + verbosityHelp() + "d[ecode] [options] <file_apk>", DecodeOptions);
    formatter.printHelp("apktool " + verbosityHelp() + "b[uild] [options] <app_path>", BuildOptions);
    if (isAdvanceMode()) {
        formatter.printHelp("apktool " + verbosityHelp() + "publicize-resources <file_path>", emptyOptions);
        formatter.printHelp("apktool " + verbosityHelp() + "empty-framework-dir [options]",
                emptyFrameworkOptions);
        System.out.println("");
    } else {
        System.out.println("");
    }

    // print out more information
    System.out.println("For additional info, see: http://ibotpeaches.github.io/Apktool/ \n"
            + "For smali/baksmali info, see: https://github.com/JesusFreke/smali");
}

From source file:io.github.retz.cli.Launcher.java

private static void help() {
    HelpFormatter formatter = new HelpFormatter();
    formatter.setWidth(Integer.MAX_VALUE);
    formatter.printHelp(MessageFormat.format("java -classpath ... {0}", Launcher.class.getName()),

            OPTIONS, true);/*from w  w  w  .j av a 2s.  c  o m*/
}

From source file:com.asakusafw.lang.compiler.cli.BatchCompilerCli.java

/**
 * The program entry./*  w w  w.j  ava 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.asList(args)),
                e);
        HelpFormatter formatter = new HelpFormatter();
        formatter.setWidth(Integer.MAX_VALUE);
        formatter.printHelp(MessageFormat.format("java -classpath ... {0}", //$NON-NLS-1$
                BatchCompilerCli.class.getName()), new Opts().options, true);
        return 1;
    }
    try {
        if (process(configuration) == false) {
            return 1;
        }
    } catch (Exception e) {
        LOG.error(MessageFormat.format("error occurred while compiling batch classes: {0}",
                Arrays.toString(args)), e);
        return 1;
    }
    return 0;
}

From source file:com.google.api.ads.adwords.keywordoptimizer.KeywordOptimizer.java

/**
 * Prints the help screen.//from  w  w  w .j a v  a 2s.co m
 *
 * @param options the expected command line parameters
 */
private static void printHelp(Options options) {
    // Automatically generate the help statement.
    HelpFormatter formatter = new HelpFormatter();
    formatter.setWidth(LINE_MAX_WIDTH);

    // Comparator to show non-argument options first.
    formatter.setOptionComparator(new Comparator<Option>() {
        @Override
        public int compare(Option o1, Option o2) {
            if (o1.hasArg() && !o2.hasArg()) {
                return 1;
            }
            if (!o1.hasArg() && o2.hasArg()) {
                return -1;
            }

            return o1.getOpt().compareTo(o2.getOpt());
        }
    });

    System.out.println("Keyword Optimizer - BETA");
    System.out.println("------------------------");
    System.out.println();
    System.out.println("This utility can be used creating a optimizing and finding a set of "
            + "'good' keywords. It uses the TargetingIdeaService / \n"
            + "TrafficEstimatorService of the AdWords API to first obtain a set "
            + "of seed keywords and then perform a round-based \nprocess for " + "optimizing them.");
    System.out.println();
    formatter.printHelp("keyword-optimizer", options);
    System.out.println();
}

From source file:com.blockwithme.longdb.tools.DBTool.java

/** Show help. */
private static void showHelp() {
    final HelpFormatter formatter = new HelpFormatter();
    formatter.setWidth(300);
    formatter.printHelp("DBTool", CURR_OPTS);
}

From source file:com.bigdata.dastor.tools.DastorAdminCli.java

/**
 * Prints usage information to stdout./* w  w w . j a v  a2 s .  c  o m*/
 */
public static void printUsage() {
    HelpFormatter hf = new HelpFormatter();
    hf.setWidth(120);
    String footer = String.format("\n-- Basic monitoring commands: "
            + "\n topo         - the topo of the cluster, by this node known."
            + "\n info         - the summary info of this node."
            + "\n bktstats     - the schema and stats of bucket(s): <KS> [BKT...]"
            + "\n sysstats     - the schema and stats of system spaces."
            + "\n pxystats     - the stats of this node as a proxy."
            + "\n keydist      - the distribution (replication nodes) of a key: <KS> <KEY>"
            + "\n thstats      - the stats of thread-pools."
            + "\n streams      - the streaming files to all other nodes or specified node: [node]"
            + "\n cmstats      - the stats of compaction." + "\n ddstats      - the stats of deputy transfer."
            + "\n -" +

            "\n-- Basic operation commands: "
            + "\n flush        - force flush memtables of bucket(s): <KS> [BKT...]"
            + "\n repair       - force check and repair difference of replicas: <KS> [BKT...]"
            + "\n compact      - force compact data: <THRESHOLD> <KS> [BKT...]"
            + "\n cleanup      - force clean data that do not belong this node: <KS> [BKT...]"
            + "\n gc           - force garbadge collection (to delete compacted-sstables)."
            + "\n dlvhints     - force deliver hints to one node: <HOST>" + "\n -" +

            // "\n-- Advanced operation commands for experts! : " + 
            // "\n drain        - shuts node off to writes, empties memtables and the commit log." +
            // "\n decommission - decommission this node from cluster." +
            // "\n move         - move the node to new position or find a new position to boot to according to load." +
            // "\n loadbalance  - load banance all nodes." +
            // "\n removepcode  - remove position code." +    
            // "\n snapshot     - takes a snapshot for every table: [snapshotname]" +
            // "\n csnapshot    - clear all snapshots." +
            // "\n " +

            "\n-- Advanced Cluster-Wide operation commands: "
            + "\n gresetbkt - graceful reset a bucket in cluster, the name is user-defined: [undo]" +

            // "\n gsnapshot    - takes a snapshot for every table in cluster: [snapshotname]" +
            // "\n gcsnapshot   - clear all snapshots in cluster." +

            // "\n\n-- Debug commands for experts! : " + 
            // "\n setcachecap  - set cache capacity. <KS> <BKT> <keyCacheCap> <rowCacheCap> " +
            // "\n setcmthresh  - set the compaction threshold." +
            // "\n getcmthresh  - get the compaction threshold." +

            // 
            "\n -");
    String usage = String.format("Args: -h <host> -p <port> <command> <args>%n");
    hf.printHelp(usage, "", options, footer);
}

From source file:com.emc.vipr.sync.ViPRSync.java

protected static void longHelp() {
    HelpFormatter fmt = new HelpFormatter();
    fmt.setWidth(79);

    Options options = mainOptions();/*from w w  w. ja  v  a  2s. co  m*/
    for (Object o : CommonOptions.getOptions().getOptions()) {
        options.addOption((Option) o);
    }

    // Make sure we do CommonOptions first
    fmt.printHelp(
            "java -jar vipr-sync.jar -source <source-uri> [-filters <filter1>[,<filter2>,...]] -target <target-uri> [options]\n"
                    + "Common Options:",
            options);

    System.out.println(
            "\nThe following plugins are also available and can be configured with their own options:\n");

    // Do the rest
    fmt.setSyntaxPrefix("");
    for (SyncSource source : sourceLoader) {
        String summary = String.format("%s (%s)\n%s", source.getName(), source.getClass().getName(),
                source.getDocumentation());
        fmt.printHelp(summary, source.getCustomOptions());
    }
    for (SyncTarget target : targetLoader) {
        String summary = String.format("%s (%s)\n%s", target.getName(), target.getClass().getName(),
                target.getDocumentation());
        fmt.printHelp(summary, target.getCustomOptions());
    }
    for (SyncFilter filter : filterLoader) {
        String summary = String.format("%s (%s), activated by: %s\n%s", filter.getName(),
                filter.getClass().getName(), filter.getActivationName(), filter.getDocumentation());
        fmt.printHelp(summary, filter.getCustomOptions());
    }
}

From source file:com.github.codingtogenomic.CodingToGenomic.java

private static void showHelp(Options o, String msg, Integer exitVal) {
    HelpFormatter formatter = new HelpFormatter();
    formatter.setOptionComparator(new OptionComparator());
    formatter.setLeftPadding(8);//from  www .  j  a v  a  2  s  .c  om
    formatter.setWidth(80);
    if (msg != null) {
        System.out.println("\nERROR: " + msg);
    }
    formatter.printHelp("CodingToGenomic " + "[-g <gene>] [-c <coordinate>] [options]\n", o, false);
    System.out.println("");
    System.exit(exitVal);
}

From source file:com.opengamma.bbg.loader.BloombergHistoricalLoader.java

/**
 * @param options//  ww w  .  j  av a2s  .c  o  m
 */
private static void usage(Options options) {
    HelpFormatter formatter = new HelpFormatter();
    formatter.setWidth(120);
    formatter.printHelp("java " + BloombergHistoricalLoader.class.getName() + " [options]... [files]...",
            options);
}

From source file:de.oth.keycloak.util.CheckParams.java

private static void printCommandLineHelp(Options options) {
    HelpFormatter helpFormatter = new HelpFormatter();
    helpFormatter.setOptionComparator(new Comparator<Option>() {
        public int compare(Option option1, Option option2) {
            if (option1.isRequired() == option2.isRequired()) {
                if (option1.getOpt() != null && option2.getOpt() != null) {
                    return option1.getOpt().compareTo(option2.getOpt());
                } else if (option1.getLongOpt() != null && option2.getLongOpt() != null) {
                    return option1.getLongOpt().compareTo(option2.getLongOpt());
                } else {
                    return -1;
                }/*w  w w.  j  a  va  2  s  .  c  o m*/
            } else {
                return (option1.isRequired() ? -1 : 1);
            }
        }
    });
    helpFormatter.setWidth(256);
    helpFormatter.printHelp("java " + InitKeycloakServer.class.getName(), options, true);
}