Example usage for org.apache.commons.cli Option Option

List of usage examples for org.apache.commons.cli Option Option

Introduction

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

Prototype

public Option(String opt, String longOpt, boolean hasArg, String description) throws IllegalArgumentException 

Source Link

Document

Creates an Option using the specified parameters.

Usage

From source file:com.ict.dtube.tools.command.topic.UpdateTopicSubCommand.java

@Override
public Options buildCommandlineOptions(Options options) {
    Option opt = new Option("b", "brokerAddr", true, "create topic to which broker");
    opt.setRequired(false);/*from  w  w  w. jav a  2 s  . c  o  m*/
    options.addOption(opt);

    opt = new Option("c", "clusterName", true, "create topic to which cluster");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("t", "topic", true, "topic name");
    opt.setRequired(true);
    options.addOption(opt);

    opt = new Option("r", "readQueueNums", true, "set read queue nums");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("w", "writeQueueNums", true, "set write queue nums");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("p", "perm", true, "set topic's permission(W|R|WR)");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("o", "order", true, "set topic's order(true|false");
    opt.setRequired(false);
    options.addOption(opt);

    return options;
}

From source file:com.geeksaga.light.console.Main.java

private Options getOptions() {
    Option bootStrapOption = new Option("b", "bootstrap", true, "library append to class loader of bootstrap");
    bootStrapOption.setArgs(Option.UNLIMITED_VALUES);
    bootStrapOption.setArgName("library path");

    Option attachOption = new Option("a", "attach", true, "attach java process");
    attachOption.setArgs(Option.UNLIMITED_VALUES);
    attachOption.setArgName("process ID");

    Option processOption = new Option("p", "process", false, "find java process");

    Options options = new Options();
    options.addOption(bootStrapOption);// w  ww  . ja v a2  s  .c o  m
    options.addOption(attachOption);
    options.addOption(processOption);

    return options;
}

From source file:com.alibaba.rocketmq.tools.command.broker.UpdateBrokerConfigSubCommand.java

@Override
public Options buildCommandlineOptions(Options options) {
    Option opt = new Option("b", "brokerAddr", true, "update which broker");
    opt.setRequired(false);//ww w. j ava 2s .c  om
    options.addOption(opt);

    opt = new Option("c", "clusterName", true, "update which cluster");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("k", "key", true, "config key");
    opt.setRequired(true);
    options.addOption(opt);

    opt = new Option("v", "value", true, "config value");
    opt.setRequired(true);
    options.addOption(opt);

    return options;
}

From source file:com.netscape.cmstools.logging.AuditShowCLI.java

public void createOptions() {
    Option option = new Option(null, "output", true, "Output file to store audit configuration.");
    option.setArgName("file");
    options.addOption(option);/*from   w ww  .j  ava  2 s  . c o m*/
}

From source file:com.amit.api.compiler.App.java

private static Options createOptions() {
    Option project = new Option("p", "project", true, "the path to amit project file.");
    project.setRequired(true);//  w w w .  j  av a  2  s .  c o  m

    Option template = new Option("t", "template", true,
            "the path to the template used to generate the result.");
    template.setRequired(true);

    Option dest = new Option("d", "destination", true, "the destination to generate the files.");
    dest.setRequired(true);

    Options options = new Options();
    options.addOption(project);
    options.addOption(template);
    options.addOption(dest);

    return options;
}

From source file:com.yahoo.yqlplus.engine.tools.YQLPlusRun.java

protected Options createOptions() {
    Options options = new Options();
    options.addOption(new Option("h", "help", false, "Display help"));
    options.addOption(new Option("c", "command", true, "Execute a script from the command line"));
    options.addOption(new Option("s", "source", false, "Dump source of generated script"));
    options.addOption(new Option("v", "verbose", false, "Enable verbose tracing"));
    options.addOption(new Option("p", "path", true, "Add a module directory"));

    // -l <port> (listen on a port? for dev-time running of a web server)
    // a way to import a library?

    // command -h -Dargname=argval -Dargname=argvalue... -c {command} [<file>]

    options.addOption(OptionBuilder.withArgName("argument=value").hasArgs(2).withValueSeparator()
            .withDescription("define named argument").create("D"));
    return options;
}

From source file:com.alibaba.rocketmq.tools.command.namesrv.UpdateNamesrvConfigCommand.java

@Override
public Options buildCommandlineOptions(final Options options) {
    Option opt = new Option("k", "key", true, "config key");
    opt.setRequired(true);/*from  w  w w. j  a  v  a 2s.com*/
    options.addOption(opt);

    opt = new Option("v", "value", true, "config value");
    opt.setRequired(true);
    options.addOption(opt);

    return options;
}

From source file:com.netscape.cmstools.tps.config.ConfigShowCLI.java

public void createOptions() {
    Option option = new Option(null, "output", true, "Output file to store general properties.");
    option.setArgName("file");
    options.addOption(option);//from  w  w w.j a v  a 2s . c om
}

From source file:com.github.horrorho.liquiddonkey.settings.commandline.CommandLineOptions.java

static LinkedHashMap<Property, Option> propertyToOption(String itemTypes) {
    LinkedHashMap<Property, Option> options = new LinkedHashMap<>();

    options.put(FILE_OUTPUT_DIRECTORY, new Option("o", "output", true, "Output folder."));

    options.put(FILE_COMBINED,//w  w w. ja v  a2 s.  c  om
            new Option("c", "combined", false, "Do not separate each snapshot into its own folder."));

    options.put(SELECTION_UDID,
            Option.builder("u").longOpt("udid")
                    .desc("Download the backup/s with the specified UDID/s. "
                            + "Will match partial UDIDs. Leave empty to download all.")
                    .argName("hex").hasArgs().optionalArg(true).build());

    options.put(SELECTION_SNAPSHOT, Option.builder("s").longOpt("snapshot")
            .desc("Only download data in the snapshot/s specified.\n"
                    + "Negative numbers indicate relative positions from newest backup "
                    + "with -1 being the newest, -2 second newest, etc.")
            .argName("int").hasArgs().build());

    options.put(FILTER_ITEM_TYPES,
            Option.builder(null).longOpt("item-types")
                    .desc("Only download the specified item type/s:\n" + itemTypes).argName("item_type")
                    .hasArgs().build());

    options.put(FILTER_DOMAIN,
            Option.builder("d").longOpt("domain")
                    .desc("Limit files to those within the specified application domain/s.").argName("str")
                    .hasArgs().build());

    options.put(FILTER_RELATIVE_PATH, Option.builder("r").longOpt("relative-path")
            .desc("Limit files to those with the specified relative path/s").argName("str").hasArgs().build());

    options.put(FILTER_EXTENSION, Option.builder("e").longOpt("extension")
            .desc("Limit files to those with the specified extension/s.").argName("str").hasArgs().build());

    options.put(FILTER_DATE_MIN,
            Option.builder().longOpt("min-date")
                    .desc("Minimum last-modified timestamp, ISO format date. E.g. 2000-12-31.").argName("date")
                    .hasArgs().build());

    options.put(FILTER_DATE_MAX,
            Option.builder().longOpt("max-date")
                    .desc("Maximum last-modified timestamp, ISO format date. E.g. 2000-12-31.").argName("date")
                    .hasArgs().build());

    options.put(FILTER_SIZE_MIN, Option.builder().longOpt("min-size").desc("Minimum size in kilobytes.")
            .argName("Kb").hasArgs().build());

    options.put(FILTER_SIZE_MAX, Option.builder().longOpt("max-size").desc("Maximum size in kilobytes.")
            .argName("Kb").hasArgs().build());

    options.put(ENGINE_FORCE_OVERWRITE,
            new Option("f", "force", false, "Download files regardless of whether a local version exists."));

    options.put(ENGINE_PERSISTENT, new Option("p", "persistent", false,
            "More persistent in the handling of network errors, for unstable connections."));

    options.put(ENGINE_AGGRESSIVE, new Option("a", "aggressive", false, "Aggressive retrieval tactics."));

    options.put(ENGINE_THREAD_COUNT, Option.builder("t").longOpt("threads")
            .desc("The maximum number of concurrent threads.").argName("int").hasArgs().build());

    options.put(HTTP_RELAX_SSL,
            new Option(null, "relax-ssl", false, "Relaxed SSL verification, for SSL validation errors."));

    options.put(DEBUG_REPORT, new Option("w", "report", false, "Write out rudimentary reports."));

    options.put(DEBUG_PRINT_STACK_TRACE,
            new Option("x", "stack-trace", false, "Print stack trace on errors, useful for debugging."));

    options.put(ENGINE_DUMP_TOKEN, new Option(null, "token", false, "Output authentication token and exit."));

    options.put(COMMAND_LINE_HELP, new Option(null, "help", false, "Display this help and exit."));

    options.put(COMMAND_LINE_VERSION,
            new Option(null, "version", false, "Output version information and exit."));

    //        options.put(FILE_FLAT,
    //                new Option("i", "--itunes-style", false, "Download files to iTunes style format."));
    return options;
}

From source file:com.alibaba.rocketmq.tools.command.topic.UpdateOrderConfCommand.java

@Override
public Options buildCommandlineOptions(Options options) {
    Option opt = new Option("t", "topic", true, "topic name");
    opt.setRequired(true);//from   ww w.j av  a2 s.  c om
    options.addOption(opt);

    opt = new Option("v", "orderConf", true, "set order conf [eg. brokerName1:num;brokerName2:num]");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("m", "method", true, "option type [eg. put|get|delete");
    opt.setRequired(true);
    options.addOption(opt);

    return options;
}