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

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

Introduction

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

Prototype

public void setSyntaxPrefix(String prefix) 

Source Link

Document

Sets the 'syntaxPrefix'.

Usage

From source file:dk.alexandra.fresco.framework.configuration.CmdLineUtil.java

public void displayHelp() {
    HelpFormatter formatter = new HelpFormatter();
    formatter.setSyntaxPrefix("");
    formatter.printHelp("General SCE options are:", this.options);
    formatter.setSyntaxPrefix("");
    formatter.printHelp("Application specific options are:", this.appOptions);
}

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

protected static void longHelp() {
    HelpFormatter fmt = new HelpFormatter();
    fmt.setWidth(79);//w w  w.  ja  v a 2  s.c  om

    Options options = mainOptions();
    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:io.github.felsenhower.stine_calendar_bot.main.CallLevelWrapper.java

/**
 * Prints the help screen for the current Options instance and exits the
 * application//from   w  w  w  .j ava  2s  .c o m
 */
private void printHelp() {
    HelpFormatter formatter = new HelpFormatter();
    formatter.setOptionComparator(null);
    formatter.setDescPadding(4);
    formatter.setLeftPadding(2);
    formatter.setLongOptSeparator("=");
    formatter.setLongOptPrefix(" --");
    formatter.setSyntaxPrefix(cliStrings.get("Usage"));
    formatter.printHelp(cliStrings.get("UsageTemplate", appInfo.get("Name")),
            cliStrings.get("HelpHeader", appInfo.get("Name"), appInfo.get("Version")), this.options,
            cliStrings.get("HelpFooter", cliStrings.get("Author"), cliStrings.get("License"),
                    appInfo.get("ProjectPage")),
            true);
    System.exit(0);
}

From source file:com.github.lindenb.jvarkit.util.command.Command.java

protected void printOptions(final PrintStream out) {
    final Options opts = new Options();
    fillOptions(opts);/*w  w w.ja  v a2  s  .  c om*/
    final HelpFormatter fmt = new HelpFormatter();
    final PrintWriter w = new PrintWriter(out);
    fmt.setSyntaxPrefix("");
    fmt.printOptions(w, 80, opts, 4, 5);
    w.flush();
}

From source file:eu.stratosphere.yarn.Client.java

private void printUsage() {
    System.out.println("Usage:");
    HelpFormatter formatter = new HelpFormatter();
    formatter.setWidth(200);/*from w w  w.j ava  2  s  . c o  m*/
    formatter.setLeftPadding(5);
    formatter.setSyntaxPrefix("   Required");
    Options req = new Options();
    req.addOption(CONTAINER);
    formatter.printHelp(" ", req);

    formatter.setSyntaxPrefix("   Optional");
    Options opt = new Options();
    opt.addOption(VERBOSE);
    //   opt.addOption(GEN_CONF);
    //   opt.addOption(STRATOSPHERE_CONF);
    //   opt.addOption(STRATOSPHERE_JAR);
    opt.addOption(JM_MEMORY);
    opt.addOption(TM_MEMORY);
    opt.addOption(TM_CORES);
    opt.addOption(QUERY);
    opt.addOption(QUEUE);
    formatter.printHelp(" ", opt);
}

From source file:eu.stratosphere.pact.client.CliFrontend.java

/**
 * Prints the help for the client./*from  w  ww.j  a v  a 2 s.c o m*/
 * 
 * @param options A map with options for actions. 
 */
private void printHelp() {
    HelpFormatter formatter = new HelpFormatter();
    formatter.setLeftPadding(5);

    System.out.println("./pact-client [ACTION] [GENERAL_OPTIONS] [ACTION_ARGUMENTS]");

    formatter.setSyntaxPrefix("  general options:");
    formatter.printHelp(" ", this.options.get(GENERAL_OPTS));

    System.out.println("\nAction \"run\" compiles and submits a PACT program.");
    formatter.setSyntaxPrefix("  \"run\" action arguments:");
    formatter.printHelp(" ", this.options.get(ACTION_RUN));

    System.out.println("\nAction \"info\" displays information about a PACT program.");
    formatter.setSyntaxPrefix("  \"info\" action arguments:");
    formatter.printHelp(" ", this.options.get(ACTION_INFO));

    System.out.println("\nAction \"list\" lists submitted PACT programs.");
    formatter.setSyntaxPrefix("  \"list\" action arguments:");
    formatter.printHelp(" ", this.options.get(ACTION_LIST));

    System.out.println("\nAction \"cancel\" cancels a submitted PACT program.");
    formatter.setSyntaxPrefix("  \"cancel\" action arguments:");
    formatter.printHelp(" ", this.options.get(ACTION_CANCEL));

}

From source file:eu.stratosphere.client.CliFrontend.java

/**
 * Prints the help for the client./*  www  .j av  a 2  s.com*/
 * 
 * @param options A map with options for actions. 
 */
private void printHelp() {
    System.out.println("./stratosphere <ACTION> [GENERAL_OPTIONS] [ARGUMENTS]");

    HelpFormatter formatter = new HelpFormatter();
    formatter.setWidth(80);
    formatter.setLeftPadding(5);
    formatter.setSyntaxPrefix("  general options:");
    formatter.printHelp(" ", GENRAL_OPTIONS);

    printHelpForRun();
    printHelpForInfo();
    printHelpForList();
    printHelpForCancel();
}

From source file:eu.stratosphere.client.CliFrontend.java

private void printHelpForCancel() {
    HelpFormatter formatter = new HelpFormatter();
    formatter.setLeftPadding(5);/*from w  ww  .java2 s . c  o  m*/
    formatter.setWidth(80);

    System.out.println("\nAction \"cancel\" cancels a running program.");
    formatter.setSyntaxPrefix("  \"cancel\" action arguments:");
    formatter.printHelp(" ", getCancelOptions(new Options()));
}

From source file:eu.stratosphere.client.CliFrontend.java

private void printHelpForList() {
    HelpFormatter formatter = new HelpFormatter();
    formatter.setLeftPadding(5);/*from ww  w.j  av a 2  s  .c om*/
    formatter.setWidth(80);

    System.out.println("\nAction \"list\" lists running and finished programs.");
    formatter.setSyntaxPrefix("  \"list\" action arguments:");
    formatter.printHelp(" ", getListOptions(new Options()));
}

From source file:eu.stratosphere.client.CliFrontend.java

private void printHelpForInfo() {
    HelpFormatter formatter = new HelpFormatter();
    formatter.setLeftPadding(5);/*w  ww  . j a v a  2  s . c o m*/
    formatter.setWidth(80);

    System.out.println("\nAction \"info\" displays information about a program.");
    formatter.setSyntaxPrefix("  \"info\" action arguments:");
    formatter.printHelp(" ", getInfoOptionsWithoutDeprecatedOptions(new Options()));
}