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

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

Introduction

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

Prototype

public static OptionBuilder isRequired(boolean newRequired) 

Source Link

Document

The next Option created will be required if required is true.

Usage

From source file:de.unisb.cs.st.javaslicer.slicing.DirectSlicer.java

@SuppressWarnings("static-access")
private static Options createOptions() {
    Options options = new Options();
    options.addOption(OptionBuilder.isRequired(false).withArgName("threadid").hasArg(true)
            .withDescription("thread id to select for slicing (default: main thread)").withLongOpt("threadid")
            .create('t'));
    options.addOption(OptionBuilder.isRequired(false).hasArg(false)
            .withDescription("show progress while computing the dynamic slice").withLongOpt("progress")
            .create('p'));
    options.addOption(OptionBuilder.isRequired(false).hasArg(false).withDescription("print this help and exit")
            .withLongOpt("help").create('h'));
    return options;
}

From source file:com.opengamma.integration.tool.config.FuturePriceCurveCreator.java

@SuppressWarnings("static-access")
private Option createSearchOption() {
    return OptionBuilder.isRequired(false).hasArgs().withArgName("name search string")
            .withDescription("The name(s) you want to search for (globbing available) - default all")
            .withLongOpt("name").create("n");
}

From source file:com.opengamma.integration.tool.config.FuturePriceCurveCreator.java

@SuppressWarnings("static-access")
private Option createSkipExistingOption() {
    return OptionBuilder.isRequired(false).hasArg(false)
            .withDescription("Skip surfaces that already exist - do not overwrite").withLongOpt("skip")
            .create("s");
}

From source file:de.unisb.cs.st.javaslicer.slicing.Slicer.java

@SuppressWarnings("static-access")
private static Options createOptions() {
    Options options = new Options();
    options.addOption(OptionBuilder.isRequired(false).withArgName("threadid").hasArg(true)
            .withDescription("thread id to select for slicing (default: main thread)").withLongOpt("threadid")
            .create('t'));
    options.addOption(OptionBuilder.isRequired(false).hasArg(false)
            .withDescription("show progress while computing the dynamic slice").withLongOpt("progress")
            .create('p'));
    options.addOption(OptionBuilder.isRequired(false).hasArg(false).withDescription("print this help and exit")
            .withLongOpt("help").create('h'));
    options.addOption(OptionBuilder.isRequired(false).hasArg(true).withArgName("value").withDescription(
            "process the trace in a multithreaded way (pass 'true' or '1' to enable, anything else to disable). Default is true iff we have more than one processor")
            .withLongOpt("multithreaded").create('m'));
    options.addOption(OptionBuilder.isRequired(false).hasArg(false)
            .withDescription("warn once for each method which is called but not traced")
            .withLongOpt("warn-untraced").create('u'));
    return options;
}

From source file:de.rrze.idmone.utils.jpwgen.PwGenerator.java

/**
 * Creates a CLI entry.//from  w  w w  .  j  a va 2s  . c o  m
 * 
 * @param shortOption
 *            a one letter flag
 * @param longOption
 *            long flag
 * @param description
 *            the description of the cCLI option
 * @param arg
 *            specifies whether the option has arguments
 * @param required
 *            specifies whether the option is required
 * @return a new instance of a CLI option with the predefined properties
 */
private synchronized static Option createOption(String shortOption, String longOption, String description,
        boolean arg, boolean required) {
    OptionBuilder.withLongOpt(longOption);
    OptionBuilder.withDescription(description);
    OptionBuilder.isRequired(required);
    if (arg)
        OptionBuilder.hasArg();
    Option option = OptionBuilder.create(shortOption);

    return option;
}

From source file:org.acmsl.queryj.tools.cli.QueryJCLIHelper.java

/**
 * Creates the command-line option for the <i>custom SQL</i>.
 * @return such <code>Option</code> instance.
 *///from   w ww  .j  av  a 2 s . co m
public Option createCustomSqlOption() {
    OptionBuilder.withArgName("file");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(CUSTOM_SQL_OPTION_DESCRIPTION);
    OptionBuilder.withLongOpt(CUSTOM_SQL_LONG_OPTION);
    OptionBuilder.isRequired(false);
    return OptionBuilder.create(CUSTOM_SQL_OPTION);
}

From source file:org.acmsl.queryj.tools.cli.QueryJCLIHelper.java

/**
 * Creates the command-line long option for the <i>custom SQL</i>.
 * @return such <code>Option</code> instance.
 *//*from w w  w.j  a va 2  s .  c  o m*/
public Option createCustomSqlLongOption() {
    OptionBuilder.withArgName("file");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(CUSTOM_SQL_OPTION_DESCRIPTION);
    OptionBuilder.isRequired(false);
    return OptionBuilder.create(CUSTOM_SQL_LONG_OPTION);
}

From source file:org.acmsl.queryj.tools.cli.QueryJCLIHelper.java

/**
 * Creates the command-line option for the verbosity levels.
 * @return such <code>Option</code> instances.
 *//* w w w .  j  ava  2 s .com*/
@NotNull
public Option[] createVerbosityOptions() {
    @NotNull
    final Collection<Option> t_cResult = new ArrayList<>();

    OptionBuilder.withArgName("v");
    OptionBuilder.withDescription(INFO_VERBOSITY_OPTION_DESCRIPTION);
    OptionBuilder.isRequired(false);
    @NotNull
    Option t_Option = OptionBuilder.create(INFO_VERBOSITY_OPTION);
    t_cResult.add(t_Option);

    OptionBuilder.withArgName("vv");
    OptionBuilder.withDescription(DEBUG_VERBOSITY_OPTION_DESCRIPTION);
    OptionBuilder.isRequired(false);
    t_Option = OptionBuilder.create(DEBUG_VERBOSITY_OPTION);
    ;

    t_cResult.add(t_Option);

    OptionBuilder.withArgName("vvv");
    OptionBuilder.withDescription(TRACE_VERBOSITY_OPTION_DESCRIPTION);
    OptionBuilder.isRequired(false);
    t_Option = OptionBuilder.create(TRACE_VERBOSITY_OPTION);
    t_cResult.add(t_Option);

    return t_cResult.toArray(EMPTY_OPTION_ARRAY);
}

From source file:org.acmsl.queryj.tools.cli.QueryJCLIHelper.java

/**
 * Creates the command-line option for the <i>help</i>.
 * @return such <code>Option</code> instance.
 *///  www. j  a v a2  s . com
@NotNull
public Option createHelpOption() {
    OptionBuilder.withDescription(HELP_OPTION_DESCRIPTION);
    OptionBuilder.isRequired(false);
    return OptionBuilder.create(HELP_OPTION);
}

From source file:org.acmsl.queryj.tools.cli.QueryJCLIHelper.java

/**
 * Creates the command-line long option for the <i>help</i>.
 * @return such <code>Option</code> instance.
 *///from w w  w .java 2s . co m
@NotNull
public Option createHelpLongOption() {
    OptionBuilder.withDescription(HELP_OPTION_DESCRIPTION);
    OptionBuilder.withLongOpt(HELP_LONG_OPTION);
    OptionBuilder.isRequired(false);
    return OptionBuilder.create(HELP_LONG_OPTION);
}