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() 

Source Link

Document

The next Option created will require an argument value.

Usage

From source file:norbert.mynemo.ui.RecommendCommandParser.java

private static Options getOptions() {
    // algorithm option
    OptionBuilder.isRequired();//from   www .  j a  v  a 2s  .  c  o  m
    OptionBuilder.hasArg();
    OptionBuilder.withArgName(ALGORITHM_ARG_NAME);
    OptionBuilder.withLongOpt(ALGORITHM_LONG_OPTION);
    OptionBuilder.withDescription(ALGORITHM_DESCRIPTION);
    Option algorithm = OptionBuilder.create(ALGORITHM_CHAR_OPTION);

    // data model option
    OptionBuilder.isRequired();
    OptionBuilder.hasArg();
    OptionBuilder.withArgName(DATAMODEL_ARG_NAME);
    OptionBuilder.withLongOpt(DATAMODEL_LONG_OPTION);
    OptionBuilder.withDescription(DATAMODEL_DESCRIPTION);
    Option dataModel = OptionBuilder.create(DATAMODEL_CHAR_OPTION);

    // user option
    OptionBuilder.isRequired();
    OptionBuilder.hasArg();
    OptionBuilder.withArgName(USER_ARG_NAME);
    OptionBuilder.withLongOpt(USER_LONG_OPTION);
    OptionBuilder.withDescription(USER_DESCRIPTION);
    Option user = OptionBuilder.create(USER_CHAR_OPTION);

    // recommendations option
    OptionBuilder.hasArg();
    OptionBuilder.withArgName(RECOMMENDATIONS_ARG_NAME);
    OptionBuilder.withLongOpt(RECOMMENDATIONS_LONG_OPTION);
    OptionBuilder.withDescription(RECOMMENDATIONS_DESCRIPTION);
    Option recommendation = OptionBuilder.create(RECOMMENDATIONS_CHAR_OPTION);

    // features option
    OptionBuilder.hasArg();
    OptionBuilder.withArgName(FEATURES_ARG_NAME);
    OptionBuilder.withLongOpt(FEATURES_LONG_OPTION);
    OptionBuilder.withDescription(FEATURES_DESCRIPTION);
    Option features = OptionBuilder.create(FEATURES_CHAR_OPTION);

    // iterations option
    OptionBuilder.hasArg();
    OptionBuilder.withArgName(ITERATIONS_ARG_NAME);
    OptionBuilder.withLongOpt(ITERATIONS_LONG_OPTION);
    OptionBuilder.withDescription(ITERATIONS_DESCRIPTION);
    Option iterations = OptionBuilder.create(ITERATIONS_CHAR_OPTION);

    // neighbors option
    OptionBuilder.hasArg();
    OptionBuilder.withArgName(NEIGHBORS_ARG_NAME);
    OptionBuilder.withLongOpt(NEIGHBORS_LONG_OPTION);
    OptionBuilder.withDescription(NEIGHBORS_DESCRIPTION);
    Option neighbors = OptionBuilder.create(NEIGHBORS_CHAR_OPTION);

    return new Options().addOption(algorithm).addOption(dataModel).addOption(user).addOption(neighbors)
            .addOption(recommendation).addOption(features).addOption(iterations);
}

From source file:norbert.mynemo.ui.ScrapeCommandParser.java

private static Options getOptions() {
    // out movies
    OptionBuilder.isRequired();/*w ww  . java 2s. c  o  m*/
    OptionBuilder.hasArg();
    OptionBuilder.withArgName(OUT_MOVIES_ARG_NAME);
    OptionBuilder.withLongOpt(OUT_MOVIES_LONG_OPTION);
    OptionBuilder.withDescription(OUT_MOVIES_DESCRIPTION);
    Option outMovies = OptionBuilder.create(OUT_MOVIES_CHAR_OPTION);

    // out ratings
    OptionBuilder.isRequired();
    OptionBuilder.hasArg();
    OptionBuilder.withArgName(OUT_RATINGS_ARG_NAME);
    OptionBuilder.withLongOpt(OUT_RATINGS_LONG_OPTION);
    OptionBuilder.withDescription(OUT_RATINGS_DESCRIPTION);
    Option outRatings = OptionBuilder.create(OUT_RATINGS_CHAR_OPTION);

    // input files
    OptionBuilder.isRequired();
    OptionBuilder.hasArgs();
    OptionBuilder.withArgName(IN_ARG_NAME);
    OptionBuilder.withLongOpt(IN_LONG_OPTION);
    OptionBuilder.withDescription(IN_DESCRIPTION);
    Option in = OptionBuilder.create(IN_CHAR_OPTION);

    // user agent file
    OptionBuilder.isRequired();
    OptionBuilder.hasArg();
    OptionBuilder.withArgName(USERAGENTS_ARG_NAME);
    OptionBuilder.withLongOpt(USERAGENTS_LONG_OPTION);
    OptionBuilder.withDescription(USERAGENTS_DESCRIPTION);
    Option userAgents = OptionBuilder.create(USERAGENTS_CHAR_OPTION);

    // movie blacklist file
    OptionBuilder.isRequired();
    OptionBuilder.hasArg();
    OptionBuilder.withArgName(MOVIE_BLACKLIST_ARG_NAME);
    OptionBuilder.withLongOpt(MOVIE_BLACKLIST_LONG_OPTION);
    OptionBuilder.withDescription(MOVIE_BLACKLIST_DESCRIPTION);
    Option movieBlacklist = OptionBuilder.create();

    // user blacklist file
    OptionBuilder.isRequired();
    OptionBuilder.hasArg();
    OptionBuilder.withArgName(USER_BLACKLIST_ARG_NAME);
    OptionBuilder.withLongOpt(USER_BLACKLIST_LONG_OPTION);
    OptionBuilder.withDescription(USER_BLACKLIST_DESCRIPTION);
    Option userBlacklist = OptionBuilder.create();

    return new Options().addOption(outMovies).addOption(outRatings).addOption(in).addOption(userAgents)
            .addOption(movieBlacklist).addOption(userBlacklist);
}

From source file:norbert.mynemo.ui.SelectCommandParser.java

private static Options getOptions() {
    OptionBuilder.isRequired();//  w  w  w.ja  v  a2s .co  m
    OptionBuilder.hasArg();
    OptionBuilder.withArgName(DATAMODEL_ARG_NAME);
    OptionBuilder.withDescription(DATAMODEL_DESCRIPTION);
    OptionBuilder.withLongOpt(DATAMODEL_LONG_OPTION);
    Option dataModel = OptionBuilder.create(DATAMODEL_CHAR_OPTION);

    OptionBuilder.isRequired();
    OptionBuilder.hasArg();
    OptionBuilder.withArgName(USER_ARG_NAME);
    OptionBuilder.withLongOpt(USER_LONG_OPTION);
    OptionBuilder.withDescription(USER_DESCRIPTION);
    Option user = OptionBuilder.create(USER_CHAR_OPTION);

    OptionBuilder.hasArgs();
    OptionBuilder.withArgName(ALGORITHMS_ARG_NAME);
    OptionBuilder.withLongOpt(ALGORITHMS_LONG_OPTION);
    OptionBuilder.withDescription(ALGORITHMS_DESCRIPTION);
    Option algorithms = OptionBuilder.create(ALGORITHMS_CHAR_OPTION);

    OptionBuilder.hasArg();
    OptionBuilder.withArgName(METRIC_ARG_NAME);
    OptionBuilder.withLongOpt(METRIC_LONG_OPTION);
    OptionBuilder.withDescription(METRIC_DESCRIPTION);
    Option metric = OptionBuilder.create(METRIC_CHAR_OPTION);

    OptionBuilder.hasArg();
    OptionBuilder.withArgName(SPEED_ARG_NAME);
    OptionBuilder.withLongOpt(SPEED_LONG_OPTION);
    OptionBuilder.withDescription(SPEED_DESCRIPTION);
    Option speed = OptionBuilder.create(SPEED_CHAR_OPTION);

    OptionBuilder.hasArg();
    OptionBuilder.withArgName(COVERAGE_ARG_NAME);
    OptionBuilder.withLongOpt(COVERAGE_LONG_OPTION);
    OptionBuilder.withDescription(COVERAGE_DESCRIPTION);
    Option coverage = OptionBuilder.create(COVERAGE_CHAR_OPTION);

    return new Options().addOption(dataModel).addOption(user).addOption(algorithms).addOption(metric)
            .addOption(speed).addOption(coverage);
}

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

/**
 * Creates the command-line option for the <i>configuration properties</i>.
 * @return such <code>Option</code> instance.
 *//*from  ww w .  j  ava 2  s.  c om*/
public Option createConfigurationOption() {
    OptionBuilder.withArgName("file");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(CONFIGURATION_PROPERTIES_OPTION_DESCRIPTION);

    return OptionBuilder.create(CONFIGURATION_PROPERTIES_OPTION);
}

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

/**
 * Creates the command-line long option for the
 * <i>configuration properties</i>.
 * @return such <code>Option</code> instance.
 *//*from   w w  w.j a  va  2  s . c  o  m*/
public Option createConfigurationLongOption() {
    OptionBuilder.withArgName("file");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(CONFIGURATION_PROPERTIES_OPTION_DESCRIPTION);
    return OptionBuilder.create(CONFIGURATION_PROPERTIES_LONG_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 w  w  .j  av a2  s .  c o  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.
 *//* w  w  w .  java  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.apache.ambari.client.ClusterCreate.java

public void addOptions() {

    Option wait = new Option("wait", "Optionally wait for cluster to reach desired state");
    Option dry_run = new Option("dry_run", "Dry run");
    Option help = new Option("help", "Help");

    OptionBuilder.withArgName("cluster_name");
    OptionBuilder.isRequired();//from www . j  a  va2 s .  c  o m
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("Name of the cluster to be created");
    Option name = OptionBuilder.create("name");

    OptionBuilder.withArgName("stack_name");
    OptionBuilder.isRequired();
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("Name of the cluster stack");
    Option stack = OptionBuilder.create("stack");

    OptionBuilder.withArgName("\"node_exp1; node_exp2; ...\"");
    OptionBuilder.isRequired();
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
            "List of node range expressions separated by semicolon (;) and contained in double quotes (\"\")");
    Option nodes = OptionBuilder.create("nodes");

    OptionBuilder.withArgName("stack_revision");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("Stack revision, if not specified latest revision is used");
    Option revision = OptionBuilder.create("revision");

    OptionBuilder.withArgName("description");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("Description to be associated with cluster");
    Option desc = OptionBuilder.create("desc");

    OptionBuilder.withArgName("goalstate");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("Desired goal state of the cluster");
    Option goalstate = OptionBuilder.create("goalstate");

    OptionBuilder.withArgName("\"component-1; component-2; ...\"");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
            "List of components to be active in the cluster. Components are seperated by semicolon \";\"");
    Option services = OptionBuilder.create("services");

    OptionBuilder.withArgName("rolename=\"node_exp1; node_exp2; ... \"");
    OptionBuilder.hasArgs(2);
    OptionBuilder.withValueSeparator();
    OptionBuilder.withDescription(
            "Provide node range expressions for a given rolename separated by semicolon (;) and contained in double quotes (\"\")");
    Option role = OptionBuilder.create("role");

    this.options = new Options();
    options.addOption(wait);
    options.addOption(dry_run);
    options.addOption(name);
    options.addOption(stack);
    options.addOption(revision);
    options.addOption(desc);
    options.addOption(role);
    options.addOption(goalstate);
    options.addOption(nodes);
    options.addOption(services);
    options.addOption(help);
}

From source file:org.apache.ambari.client.ClusterDelete.java

public void addOptions() {

    Option wait = new Option("wait", "Optionally wait for cluster to reach desired state");
    Option help = new Option("help", "Help");

    OptionBuilder.withArgName("cluster_name");
    OptionBuilder.isRequired();/*from  w ww . jav  a2 s .  c o m*/
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("Name of the cluster to be deleted");
    Option name = OptionBuilder.create("name");

    this.options = new Options();
    options.addOption(wait);
    options.addOption(name);
    options.addOption(help);
}

From source file:org.apache.ambari.client.ClusterGet.java

public void addOptions() {

    Option help = new Option("help", "Help");
    Option verbose = new Option("verbose", "Verbose mode");

    OptionBuilder.withArgName("cluster_name");
    OptionBuilder.isRequired();/*ww w . ja v  a2 s.  c o m*/
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("Name of the cluster");
    Option name = OptionBuilder.create("name");

    this.options = new Options();
    options.addOption(name);
    options.addOption(verbose);
    options.addOption(help);
}