Example usage for org.apache.commons.cli OptionBuilder withDescription

List of usage examples for org.apache.commons.cli OptionBuilder withDescription

Introduction

In this page you can find the example usage for org.apache.commons.cli OptionBuilder withDescription.

Prototype

public static OptionBuilder withDescription(String newDescription) 

Source Link

Document

The next Option created will have the specified description

Usage

From source file:chibi.gemmaanalysis.MetaLinkFinderCli.java

@SuppressWarnings("static-access")
@Override/*from ww w.  ja  va2  s  .  co m*/
protected void buildOptions() {
    Option writeLinkMatrixo = OptionBuilder.withDescription(
            "Giving this option will generate the new link matrix, Otherwise reading the link matrix from file")
            .withLongOpt("linkMatrix").create('l');
    addOption(writeLinkMatrixo);
    Option writeTree = OptionBuilder.withDescription(
            "Giving this option will generate the new clustering tree, Otherwise reading the tree from file")
            .withLongOpt("clusteringTree").create('c');
    addOption(writeTree);
    Option matrixFileo = OptionBuilder.hasArg().withArgName("Bit Matrixfile").isRequired()
            .withDescription("The file for saving bit matrix").withLongOpt("matrixfile").create('m');
    addOption(matrixFileo);

    Option mapFile = OptionBuilder.hasArg().withArgName("Expression Experiment Map File").isRequired()
            .withDescription("The File for Saving the Expression Experiment Mapping").withLongOpt("mapfile")
            .create('e');
    addOption(mapFile);

    Option treeFileo = OptionBuilder.hasArg().withArgName("Clustering Tree File").isRequired()
            .withDescription("The file for saving clustering tree").withLongOpt("treefile").create('t');
    addOption(treeFileo);

    Option specieso = OptionBuilder.hasArg().withArgName("The name of the species").isRequired()
            .withDescription("The name of the species").withLongOpt("species").create('s');
    addOption(specieso);

}

From source file:com.cloudera.sqoop.tool.MetastoreTool.java

@Override
/** Configure the command-line arguments we expect to receive */
public void configureOptions(ToolOptions toolOptions) {
    RelatedOptions opts = new RelatedOptions("metastore arguments");
    opts.addOption(OptionBuilder.withDescription("Cleanly shut down a running metastore")
            .withLongOpt(METASTORE_SHUTDOWN_ARG).create());

    toolOptions.addUniqueOptions(opts);/*from w w w.  j a  v  a  2s . c  o m*/
}

From source file:carmen.utils.Utils.java

public static void registerOption(List<Option> options, String option_name, String arg_name, boolean has_arg,
        String description) {//from   ww  w  .  ja  va 2  s . c o  m
    OptionBuilder.withArgName(arg_name);
    OptionBuilder.hasArg(has_arg);
    OptionBuilder.withDescription(description);
    Option option = OptionBuilder.create(option_name);

    options.add(option);
}

From source file:com.google.code.bing.search.example.AdSample.java

/**
 * Builds the options./*from   w ww. j  ava2  s  .  co  m*/
 * 
 * @return the options
 */
private static Options buildOptions() {

    Options opts = new Options();

    String helpMsg = "Print this message.";
    Option help = new Option(HELP_OPTION, helpMsg);
    opts.addOption(help);

    String applicationKeyMsg = "You Application ID.";
    OptionBuilder.withArgName("appid");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(applicationKeyMsg);
    Option applicationKey = OptionBuilder.create(APPLICATION_KEY_OPTION);
    opts.addOption(applicationKey);

    String queryMsg = "Search Query.";
    OptionBuilder.withArgName("query");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(queryMsg);
    Option query = OptionBuilder.create(QUERY_OPTION);
    opts.addOption(query);

    return opts;
}

From source file:com.boundary.sdk.snmp.metric.ExportMibCli.java

@SuppressWarnings("static-access")
private void buildOptions() {
    helpOption = OptionBuilder.withDescription("Display help information").withLongOpt("help").create("?");

    licenseOption = OptionBuilder.withArgName("license").hasArgs().withValueSeparator(' ').withDescription(
            "The license key string you received with the purchase a SNMP4J-SMI license or its evaluation."
                    + "You may provide leave empty, but then you may not use any MIB modules of the \"enterprise\" OID subtree.")
            .withLongOpt("license").create("l");

    repoDirOption = OptionBuilder.withArgName("repository_dir").hasArg().isRequired()
            .withDescription("Directory where the " + commandName + " can read compiled MIB modules.")
            .withLongOpt("repository-dir").create("r");

    verboseOption = OptionBuilder.withDescription("Verbose mode, provide additional debug output.")
            .withLongOpt("verbose").create("v");

    exportOption = OptionBuilder.withArgName("type").hasArgs(1)
            .withDescription("Selects what to export which is either: METRIC,OID, or OUT. Defaults to METRIC.")
            .withLongOpt("export").create("e");

    mibOption = OptionBuilder.withArgName("mib_name").hasArgs().isRequired().withValueSeparator(',')
            .withDescription("List of MIB(s) to export. Example: SNMPv2-MIB").withLongOpt("mib").create("m");

    options.addOption(helpOption);/*from w  w w.j a  va 2  s. c  om*/
    options.addOption(verboseOption);
    options.addOption(licenseOption);
    options.addOption(repoDirOption);
    options.addOption(exportOption);
    options.addOption(mibOption);

}

From source file:jlite.cli.JobMatch.java

private static Options setupOptions() {
    Options options = new Options();

    options.addOption(OptionBuilder.withDescription("displays usage").create("help"));

    options.addOption(OptionBuilder.withArgName("id_string")
            .withDescription("delegation id (default is user name)").hasArg().create("d"));

    options.addOption(OptionBuilder.withDescription("automatic proxy delegation").create("a"));

    options.addOption(OptionBuilder.withArgName("service_URL").withDescription("WMProxy service endpoint")
            .hasArg().create("e"));

    options.addOption(OptionBuilder.withArgName("proxyfile")
            .withDescription("non-standard location of proxy cert").hasArg().create("proxypath"));

    options.addOption(OptionBuilder.withArgName("xml").withDescription("output as xml").create("xml"));

    return options;
}

From source file:consumer.kafka.client.Consumer.java

private void init(String[] args) throws Exception {

    Options options = new Options();
    this._props = new Properties();

    options.addOption("p", true, "properties filename from the classpath");
    options.addOption("P", true, "external properties filename");

    OptionBuilder.withArgName("property=value");
    OptionBuilder.hasArgs(2);// w w  w  .java 2s  .c  o  m
    OptionBuilder.withValueSeparator();
    OptionBuilder.withDescription("use value for given property");
    options.addOption(OptionBuilder.create("D"));

    CommandLineParser parser = new PosixParser();
    CommandLine cmd = parser.parse(options, args);
    if (cmd.hasOption('p')) {
        this._props.load(ClassLoader.getSystemClassLoader().getResourceAsStream(cmd.getOptionValue('p')));
    }
    if (cmd.hasOption('P')) {
        File file = new File(cmd.getOptionValue('P'));
        FileInputStream fStream = new FileInputStream(file);
        this._props.load(fStream);
    }
    this._props.putAll(cmd.getOptionProperties("D"));

}

From source file:jlite.cli.ProxyInit.java

private static Options setupOptions() {
    Options options = new Options();

    options.addOption(OptionBuilder.withDescription("displays usage").create("help"));

    options.addOption(OptionBuilder.withDescription("enables extra debug output").create("debug"));

    options.addOption(OptionBuilder.withArgName("h:m")
            .withDescription("proxy and AC are valid for h hours and m minutes (defaults to 12:00)").hasArg()
            .create("valid"));

    options.addOption(OptionBuilder.withDescription("creates a limited proxy").create("limited"));

    options.addOption(OptionBuilder.withArgName("version")
            .withDescription("version of proxy certificate {2,3,4} (default is 2)").hasArg()
            .create("proxyver"));

    options.addOption(OptionBuilder//  w ww .j a v a 2  s. c o  m
            .withDescription("creates RFC 3820 compliant proxy (synonomous with -proxyver 4)").create("rfc"));

    options.addOption(OptionBuilder.withArgName("proxyfile")
            .withDescription("non-standard location of new proxy cert").hasArg().create("out"));

    options.addOption(OptionBuilder.withArgName("path")
            .withDescription("non-standard location of VOMS configuration files").hasArg().create("vomses"));

    options.addOption(OptionBuilder.withArgName("key")
            .withDescription("set your private key passphrase without any prompt").hasArg().create("password"));

    options.addOption(OptionBuilder.withArgName("xml").withDescription("output as xml").create("xml"));

    return options;
}

From source file:de.clusteval.data.dataset.generator.CassiniDataSetGenerator.java

@Override
protected Options getOptions() {
    Options options = new Options();

    OptionBuilder.withArgName("n");
    OptionBuilder.isRequired();//from w  w  w  .ja v  a  2  s.co m
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("The number of points.");
    Option option = OptionBuilder.create("n");
    options.addOption(option);

    return options;
}

From source file:de.thetaphi.forbiddenapis.CliMain.java

@SuppressWarnings({ "static-access", "static" })
public CliMain(String... args) throws ExitException {
    final OptionGroup required = new OptionGroup();
    required.setRequired(true);/* www  .j  a  v a2 s  .  c o  m*/
    required.addOption(dirOpt = OptionBuilder.withDescription(
            "directory with class files to check for forbidden api usage; this directory is also added to classpath")
            .withLongOpt("dir").hasArg().withArgName("directory").create('d'));
    required.addOption(versionOpt = OptionBuilder.withDescription("print product version and exit")
            .withLongOpt("version").create('V'));
    required.addOption(
            helpOpt = OptionBuilder.withDescription("print this help").withLongOpt("help").create('h'));

    final Options options = new Options();
    options.addOptionGroup(required);
    options.addOption(classpathOpt = OptionBuilder
            .withDescription("class search path of directories and zip/jar files").withLongOpt("classpath")
            .hasArgs().withValueSeparator(File.pathSeparatorChar).withArgName("path").create('c'));
    options.addOption(includesOpt = OptionBuilder.withDescription(
            "ANT-style pattern to select class files (separated by commas or option can be given multiple times, defaults to '**/*.class')")
            .withLongOpt("includes").hasArgs().withValueSeparator(',').withArgName("pattern").create('i'));
    options.addOption(excludesOpt = OptionBuilder.withDescription(
            "ANT-style pattern to exclude some files from checks (separated by commas or option can be given multiple times)")
            .withLongOpt("excludes").hasArgs().withValueSeparator(',').withArgName("pattern").create('e'));
    options.addOption(signaturesfileOpt = OptionBuilder
            .withDescription("path to a file containing signatures (option can be given multiple times)")
            .withLongOpt("signaturesfile").hasArg().withArgName("file").create('f'));
    options.addOption(bundledsignaturesOpt = OptionBuilder.withDescription(
            "name of a bundled signatures definition (separated by commas or option can be given multiple times)")
            .withLongOpt("bundledsignatures").hasArgs().withValueSeparator(',').withArgName("name")
            .create('b'));
    options.addOption(suppressannotationsOpt = OptionBuilder.withDescription(
            "class name or glob pattern of annotation that suppresses error reporting in classes/methods/fields (separated by commas or option can be given multiple times)")
            .withLongOpt("suppressannotation").hasArgs().withValueSeparator(',').withArgName("classname")
            .create());
    options.addOption(internalruntimeforbiddenOpt = OptionBuilder
            .withDescription("forbids calls to classes from the internal java runtime (like sun.misc.Unsafe)")
            .withLongOpt("internalruntimeforbidden").create());
    options.addOption(allowmissingclassesOpt = OptionBuilder
            .withDescription("don't fail if a referenced class is missing on classpath")
            .withLongOpt("allowmissingclasses").create());
    options.addOption(allowunresolvablesignaturesOpt = OptionBuilder
            .withDescription("don't fail if a signature is not resolving")
            .withLongOpt("allowunresolvablesignatures").create());

    try {
        this.cmd = new PosixParser().parse(options, args);
        if (cmd.hasOption(helpOpt.getLongOpt())) {
            printHelp(options);
            throw new ExitException(EXIT_SUCCESS);
        }
        if (cmd.hasOption(versionOpt.getLongOpt())) {
            printVersion();
            throw new ExitException(EXIT_SUCCESS);
        }
    } catch (org.apache.commons.cli.ParseException pe) {
        printHelp(options);
        throw new ExitException(EXIT_ERR_CMDLINE);
    }
}