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

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

Introduction

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

Prototype

public static OptionBuilder hasArg(boolean hasArg) 

Source Link

Document

The next Option created will require an argument value if hasArg is true.

Usage

From source file:eu.stratosphere.meteor.client.CLClient.java

@SuppressWarnings("static-access")
private void initOptions() {
    this.options.addOption(OptionBuilder.isRequired().withArgName("file").hasArg(true)
            .withDescription("Executes the given script").create("f"));
    this.options.addOption(OptionBuilder.withArgName("config").hasArg(true)
            .withDescription("Uses the given configuration").withLongOpt("configDir").create());
    this.options.addOption(OptionBuilder.withArgName("server").hasArg(true)
            .withDescription("Uses the specified server").withLongOpt("server").create());
    this.options.addOption(OptionBuilder.withArgName("port").hasArg(true)
            .withDescription("Uses the specified port").withLongOpt("port").create());
    this.options.addOption(OptionBuilder.withArgName("updateTime").hasArg(true)
            .withDescription("Checks with the given update time for the current status")
            .withLongOpt("updateTime").create());
    this.options.addOption(OptionBuilder.hasArg(false)
            .withDescription("Waits until the script terminates on the server").withLongOpt("wait").create());
}

From source file:edu.harvard.med.iccbl.screensaver.reports.icbg.ICBGReportGenerator.java

public ICBGReportGenerator(String[] args) throws BiffException, IOException {
    super(args);/*  w ww. ja va  2  s  .  c  om*/
    addCommandLineOption(OptionBuilder.hasArg(true).withArgName("mf").withLongOpt("mapping-file")
            .withDescription("The path to the mapping file").create("mf"));
    addCommandLineOption(OptionBuilder.hasArg(true).withArgName("cf").withLongOpt("assay-category-file")
            .withDescription("The path to the assay category file").create("cf"));
    addCommandLineOption(OptionBuilder.hasArg(true).withArgName("of").withLongOpt("output-file")
            .withDescription("The output file path").create("of"));

    processOptions(true, false);

    if (isCommandLineFlagSet("of"))
        _reportFilename = getCommandLineOptionValue("of");
    _dao = (GenericEntityDAO) getSpringBean("genericEntityDao");
    _screenResultsDAO = (ScreenResultsDAO) getSpringBean("screenResultsDao");
    _mapper = new ICCBLPlateWellToINBioLQMapper(getCommandLineOptionValue("mf"));
    _assayInfoProducer = new AssayInfoProducer(getCommandLineOptionValue("cf"));
}

From source file:com.opengamma.integration.tool.marketdata.HtsSyncTool.java

@SuppressWarnings("static-access")
private Option createFastOption() {
    return OptionBuilder.hasArg(false).withDescription("assume only new data needs copying").isRequired(false)
            .withLongOpt("fast").create("f");
}

From source file:com.opengamma.integration.tool.marketdata.HtsSyncTool.java

@SuppressWarnings("static-access")
private Option createHardSyncOption() {
    return OptionBuilder.hasArg(false)
            .withDescription("remove time series at destination not present in source").isRequired(false)
            .withLongOpt("hard-sync").create("h");
}

From source file:com.opengamma.integration.tool.marketdata.HtsSyncTool.java

@SuppressWarnings("static-access")
private Option createNoAdditionsOption() {
    return OptionBuilder.hasArg(false)
            .withDescription("don't add any time series to the destination, only update what's there")
            .isRequired(false).withLongOpt("no-additions").create("n");
}

From source file:acromusashi.kafka.log.producer.LinuxApacheLogProducer.java

/**
 * ???//from   w w w.  j  a  va2 s. c  om
 * 
 * @return ??
 */
public static Options createOptions() {
    Options cliOptions = new Options();

    // 
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("LinuxApacheLogProducer Conf Path");
    OptionBuilder.withDescription("LinuxApacheLogProducer Conf Path");
    OptionBuilder.isRequired(true);
    Option confPathOption = OptionBuilder.create("c");

    // 
    OptionBuilder.withDescription("show help");
    Option helpOption = OptionBuilder.create("h");

    cliOptions.addOption(confPathOption);
    cliOptions.addOption(helpOption);
    return cliOptions;
}

From source file:net.sf.clichart.main.OptionParser.java

private void addOption(org.apache.commons.cli.Options optionDefs, String[] optionDetails, boolean hasArgument) {
    // OptionBuilder is a stateful class
    OptionBuilder.withLongOpt(optionDetails[1]);
    OptionBuilder.withDescription(optionDetails[2]);

    if (hasArgument) {
        OptionBuilder.hasArg(true);
        OptionBuilder.withValueSeparator();
    }/*from w  w  w. jav a  2 s  .  com*/

    if (optionDetails[0] != null) {
        optionDefs.addOption(OptionBuilder.create(optionDetails[0]));
    } else {
        optionDefs.addOption(OptionBuilder.create());
    }
}

From source file:com.opengamma.integration.tool.marketdata.HtsSyncTool.java

@SuppressWarnings("static-access")
private Option createVerboseOption() {
    return OptionBuilder.hasArg(false).withDescription("show extra messages").isRequired(false)
            .withLongOpt("verbose").create("v");
}

From source file:acromusashi.stream.client.DrpcRequestClient.java

/**
 * ???/* w ww.  j  a v  a  2  s . co m*/
 * 
 * @return ??
 */
public static Options createOptions() {
    Options cliOptions = new Options();

    // DRPCServer Host
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("DRPCServer Host");
    OptionBuilder.withDescription("DRPCServer Host");
    OptionBuilder.isRequired(true);
    Option serverOption = OptionBuilder.create("h");

    // DRPCServer Port
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("DRPCServer Port");
    OptionBuilder.withDescription("DRPCServer Port");
    OptionBuilder.isRequired(false);
    Option portOption = OptionBuilder.create("p");

    // 
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("DRPC Request Timeout");
    OptionBuilder.withDescription("DRPC Request Timeout");
    OptionBuilder.isRequired(false);
    Option timeoutOption = OptionBuilder.create("t");

    // DRPC Function
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("DRPC Function");
    OptionBuilder.withDescription("DRPC Function");
    OptionBuilder.isRequired(true);
    Option functionOption = OptionBuilder.create("f");

    // DRPC Function Arg
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("DRPC Function Arg");
    OptionBuilder.withDescription("DRPC Function Arg");
    OptionBuilder.isRequired(true);
    Option funcArgOption = OptionBuilder.create("a");

    // 
    OptionBuilder.withDescription("show help");
    Option helpOption = OptionBuilder.create("sh");

    cliOptions.addOption(serverOption);
    cliOptions.addOption(portOption);
    cliOptions.addOption(timeoutOption);
    cliOptions.addOption(functionOption);
    cliOptions.addOption(funcArgOption);
    cliOptions.addOption(helpOption);
    return cliOptions;
}

From source file:com.yahoo.flowetl.commons.runner.BaseRunner.java

/**
 * Gets the command line options that this class will be using.
 * // w  ww.j  a  v  a  2  s  .co  m
 * @return the options
 */
@SuppressWarnings("static-access")
protected Options getOptions() {
    Options cliOpts = new Options();
    Option cfgFile = OptionBuilder.withArgName("file").hasArg(true).withDescription("the configuration file")
            .create(CONFIG_OPT);
    cliOpts.addOption(cfgFile);
    Option helpOpt = OptionBuilder.hasArg(false).withDescription("help message").create(HELP_OPT);
    cliOpts.addOption(helpOpt);
    return cliOpts;
}