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.alibaba.rocketmq.tools.command.message.DecodeMessageIdCommond.java

@Override
public Options buildCommandlineOptions(Options options) {
    Option opt = new Option("i", "messageId", true, "unique message ID");
    opt.setRequired(false);/*from  ww  w  . j  a va  2  s  . c  om*/
    options.addOption(opt);
    return options;
}

From source file:info.bitoo.utils.BiToorrentRemaker.java

/**
 * @return//  w  w w . ja v  a 2  s .c  o m
 */
private static Options createCommandLineOptions() {
    Option optTorrent = new Option("t", "torrent", true, "torrent file to remake");
    optTorrent.setRequired(true);

    Option optLocations = new Option("l", "locations", true,
            "pipe separated list of alternative download locations.");
    optLocations.setRequired(true);

    Options cliOptions = new Options();
    cliOptions.addOption(optTorrent);
    cliOptions.addOption(optLocations);

    return cliOptions;
}

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

@Override
public Options buildCommandlineOptions(Options options) {
    Option opt = new Option("b", "brokerAddr", true, "Broker address");
    opt.setRequired(false);/*from w  w w.  ja v a 2s . co  m*/
    options.addOption(opt);

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

    return options;
}

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

@Override
public Options buildCommandlineOptions(Options options) {
    Option opt = new Option("t", "topic", true, "topic name");
    opt.setRequired(true);//from www.  jav  a2 s  .  c  om
    options.addOption(opt);
    return options;
}

From source file:com.netscape.cmstools.key.KeyModifyCLI.java

public void createOptions() {
    Option option = new Option(null, "status", true, "Status of the key.\nValid values: active, inactive");
    option.setRequired(true);//ww w  . j  a  v a2 s.  c  o  m
    option.setArgName("status");
    options.addOption(option);
}

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

@Override
public Options buildCommandlineOptions(Options options) {
    Option opt = new Option("i", "ip", true, "set the server ip");
    opt.setRequired(false);/*  www .  j  a  va  2s . c om*/
    options.addOption(opt);

    opt = new Option("p", "project", true, "set the project group");
    opt.setRequired(false);
    options.addOption(opt);
    return options;
}

From source file:com.tvh.gmaildrafter.Drafter.java

private static Options getCMDLineOptions() {
    /*//from ww  w  .j  a v a2  s  .  co  m
     * Create the command line options
     */
    Options options = new Options();
    options.addOption(new Option("h", "help", false, "Show this help message."));

    OptionGroup body = new OptionGroup();
    body.addOption(new Option("i", "stdin", false, "Read body text from stdin."));
    body.addOption(OptionBuilder.withLongOpt("body").withArgName("filename").hasArg()
            .withDescription("File containing the body text").create("b"));
    options.addOptionGroup(body);

    options.addOption(OptionBuilder.withLongOpt("username").hasArg().withArgName("email address")
            .withDescription("Your Google Email adress.").create());
    options.addOption(OptionBuilder.withLongOpt("password").hasArg().withArgName("google password")
            .withDescription(
                    "Your Google password (caution: providing this on the commandline can be a security problem).")
            .create());

    options.addOption(OptionBuilder.withLongOpt("subject").withArgName("text").hasArg()
            .withDescription("Subject of the mail").create("s"));
    options.addOption(OptionBuilder.withLongOpt("subjectfile").withArgName("filename").hasArg()
            .withDescription("File containing the subject of the mail (UTF-8)").create());
    options.addOption(OptionBuilder.withLongOpt("attachments").hasArgs().withArgName("filename,filename,...")
            .withValueSeparator(',').withDescription("Attachments").create("a"));

    options.addOption(
            OptionBuilder.withLongOpt("attachmentnames").hasArgs().withArgName("filename,filename,...")
                    .withValueSeparator(',').withDescription("Attachment names").create("n"));

    options.addOption(OptionBuilder.withLongOpt("to").hasArgs().withArgName("foo@bar.com,oof@rab.com,...")
            .withValueSeparator(',').withDescription("destination").create("t"));

    options.addOption(new Option("d", "deletebody", false, "Delete bodyfile after sending."));
    options.addOption(new Option(null, "deletesubjectfile", false, "Delete subjectfile after sending."));

    options.addOption(new Option(null, "immediate", false, "Immediately send, don't open draft first."));
    options.addOption(OptionBuilder.withLongOpt("cc").hasArgs().withArgName("foo@bar1.com,foo@rba.com")
            .withValueSeparator(',').withDescription("cc").create("c"));
    options.addOption(OptionBuilder.withLongOpt("bcc").hasArgs().withArgName("foo@bar2.com,ofo@bar.com")
            .withValueSeparator(',').withDescription("bcc").create());

    return options;

}

From source file:com.netscape.cmstools.group.GroupAddCLI.java

public void createOptions() {
    Option option = new Option(null, "description", true, "Description");
    option.setArgName("description");
    options.addOption(option);//from  ww  w  .j  a va  2 s  .com
}

From source file:com.nubits.nubot.launch.CLIOptions.java

/**
 * Construct and provide GNU-compatible Options.
 *
 * @return Options expected from command-line of GNU form.
 *///from ww w .  j  a  v  a 2s  .  c  o m
public Options constructGnuOptions() {
    final Options gnuOptions = new Options();

    Option UIOption = new Option(GUI, "graphic user interface", false, "Run with GUI");
    gnuOptions.addOption(UIOption);

    Option CfgFileOption = new Option(CFG, "configuration file", true, "Specify Configuration file");
    gnuOptions.addOption(CfgFileOption);

    return gnuOptions;
}

From source file:demos.Main.java

private static Options getOptions() {
    return new Options().addOption(new Option("h", "help", false, "Display this message"))
            .addOption(new Option("d", "discovery", false, "Discover and log cluster nodes"))
            .addOption(new Option("t", "topology", false, "Listen for cluster topology changes"))
            .addOption(new Option("s", "sync-insert", false, "Execute synchronous/blocking inserts"))
            .addOption(new Option("a", "async-insert", false, "Execute asynchronous/non-blocking inserts"))
            .addOption(new Option("b", "batch-insert", false, "Execute batch inserts (asynchronously)"))
            .addOption(new Option("r", "sync-read", false, "Execute synchronous/blocking reads"))
            .addOption(new Option("ar", "async-read", false, "Executes asynchronous/non-blocking reads"));
}