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

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

Introduction

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

Prototype

public void setRequired(boolean required) 

Source Link

Document

Sets whether this Option is mandatory.

Usage

From source file:com.opengamma.bbg.cli.BloombergCliOptions.java

private Option createHostOption() {
    Option option = new Option("h", HOST_OPTION, true, "bloomberg server host");
    option.setRequired(_hostRequired);
    return option;
}

From source file:com.opengamma.bbg.cli.BloombergCliOptions.java

private Option createPortOption() {
    Option option = new Option("p", PORT_OPTION, true, "bloomberg server port");
    option.setRequired(_portRequired);
    return option;
}

From source file:com.opengamma.bbg.cli.BloombergCliOptions.java

private Option createDataFieldsFileOption() {
    Option option = new Option("f", FIELDS_FILE_OPTION, true, "data fields file");
    option.setRequired(_dataFieldsFileRequired);
    return option;
}

From source file:com.opengamma.bbg.cli.BloombergCliOptions.java

private Option createIdentifiersOption() {
    Option option = new Option("i", IDENTIFIERS_OPTION, true, "identifiers file");
    option.setRequired(_identifiersRequired);
    return option;
}

From source file:de.uni_koblenz.jgralab.utilities.rsa2tg.SchemaGraph2XMI.java

/**
 * Processes all command line parameters and returns a {@link CommandLine}
 * object, which holds all values included in the given {@link String}
 * array./*from w  w w . ja v  a2s.co m*/
 * 
 * @param args
 *            {@link CommandLine} parameters.
 * @return {@link CommandLine} object, which holds all necessary values.
 */
public static CommandLine processCommandLineOptions(String[] args) {

    // Creates a OptionHandler.
    String toolString = "java " + SchemaGraph2XMI.class.getName();
    String versionString = JGraLab.getInfo(false);

    OptionHandler oh = new OptionHandler(toolString, versionString);

    // Several Options are declared.
    Option output = new Option("o", "output", true, "(required): the output xmi file name");
    output.setRequired(true);
    output.setArgName("file");
    oh.addOption(output);

    Option schemaGraph = new Option("ig", "inputSchemaGraph", true,
            "(required or -i):if set, the schemaGraph is converted into a xmi.");
    schemaGraph.setRequired(false);
    schemaGraph.setArgs(0);
    output.setArgName("file");
    oh.addOption(schemaGraph);

    Option schema = new Option("i", "inputSchema", true,
            "(required or -ig): TG-file of the schema which should be converted into a xmi.");
    schema.setRequired(false);
    schema.setArgName("file");
    oh.addOption(schema);

    // either graph or schema has to be provided
    OptionGroup input = new OptionGroup();
    input.addOption(schemaGraph);
    input.addOption(schema);
    input.setRequired(true);
    oh.addOptionGroup(input);

    Option bidirectional = new Option("b", "bidirectional", false,
            "(optional): If set the EdgeClasses are created as bidirectional associations.");
    bidirectional.setRequired(false);
    oh.addOption(bidirectional);

    return oh.parse(args);
}

From source file:eu.scape_project.tool.toolwrapper.toolwrapper_bash_generator.BashWrapperGenerator.java

/** Public empty constructor (setting all instance variables to null) */
public BashWrapperGenerator() {
    super();//w w  w.j a  va  2 s.  c  o m
    tool = null;
    components = null;
    component = null;
    operation = null;
    wrapperName = null;
    bashWrapperTemplate = null;
    SimpleDateFormat sdf = new SimpleDateFormat(Constants.FULL_DATE_WITH_TIMEZONE);
    sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
    generationDate = sdf.format(new Date());

    Options options = super.getOptions();
    Option opt = new Option("c", "components", true, "components spec file location");
    opt.setRequired(false);
    options.addOption(opt);
}

From source file:datascript.instance.DataScriptInstanceTool.java

public void getOptions(org.apache.commons.cli.Options rdsOptions, String[] args) {
    org.apache.commons.cli.Option rdsOption;

    rdsOption = new Option("h", "help", false, "prints this help text and exit");
    rdsOption.setRequired(false);
    rdsOptions.addOption(rdsOption);//from w ww .j a va2 s  .c  o  m

    rdsOption = new Option("c", false, "check syntax");
    rdsOption.setRequired(false);
    rdsOptions.addOption(rdsOption);

    rdsOption = new Option("ext", true, "path to the extension directory");
    rdsOption.setRequired(false);
    rdsOptions.addOption(rdsOption);

    rdsOption = new Option("doc", true, "path to the directory in which the generated documentation is stored."
            + "currently not used in this tool");
    rdsOption.setRequired(false);
    rdsOptions.addOption(rdsOption);

    rdsOption = new Option("out", true, "path to the directory in which the generated code is stored");
    rdsOption.setRequired(false);
    rdsOptions.addOption(rdsOption);

    rdsOption = new Option("src", true, "path to DataScript source files");
    rdsOption.setRequired(false);
    rdsOptions.addOption(rdsOption);

    rdsOption = new Option("type", true, "type of instance to be parsed");
    rdsOption.setRequired(false);
    rdsOptions.addOption(rdsOption);

    rdsOption = new Option("inst", true, "path to DataScript instance file");
    rdsOption.setRequired(false);
    rdsOptions.addOption(rdsOption);
}

From source file:com.opengamma.bbg.cli.BloombergCliOptions.java

private Option createDataProviderOption() {
    Option option = new Option("p", DATAPROVIDERS_OPTION, true, "List of data providers");
    option.setArgName("CMPL,CMPT");
    option.setRequired(_dataProvidersRequired);
    return option;
}

From source file:de.bmw.yamaica.common.console.CommandExecuter.java

private Option createOption(IConfigurationElement optionConfiguration) {
    String shortName = optionConfiguration.getAttribute(OPTION_SHORT_NAME_ATTRIBUTE_NAME);
    String longName = optionConfiguration.getAttribute(OPTION_LONG_NAME_ATTRIBUTE_NAME);
    String description = optionConfiguration.getAttribute(OPTION_DESCRIPTION_ATTRIBUTE_NAME);
    String required = optionConfiguration.getAttribute(OPTION_REQUIRED_ATTRIBUTE_NAME);
    String argCount = optionConfiguration.getAttribute(OPTION_ARG_COUNT_ATTRIBUTE_NAME);
    String argName = optionConfiguration.getAttribute(OPTION_ARG_NAME_ATTRIBUTE_NAME);
    String hasOptionalArg = optionConfiguration.getAttribute(OPTION_HAS_OPTIONAL_ARG_ATTRIBUTE_NAME);
    String valueSeparator = optionConfiguration.getAttribute(OPTION_VALUE_SEPARATOR_ATTRIBUTE_NAME);

    Option option = new Option(shortName, description);
    option.setRequired(Boolean.parseBoolean(required));
    option.setArgs(Integer.parseInt(argCount));
    option.setOptionalArg(Boolean.parseBoolean(hasOptionalArg));

    if (null != longName) {
        option.setLongOpt(longName);/*www  .  ja v  a 2s .  c  o  m*/
    }

    if (null != argName) {
        option.setArgName(argName);
    }

    if (null != valueSeparator) {
        option.setValueSeparator(valueSeparator.charAt(0));
    }

    return option;
}

From source file:com.opengamma.bbg.cli.BloombergCliOptions.java

private Option createFieldsOption() {
    Option option = new Option("F", FIELDS_OPTION, true, "List of bloomberg fields");
    option.setArgName("PX_LAST,VOLUME,LAST_VOLATILITY");
    option.setRequired(_dataFieldsRequired);
    return option;
}