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

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

Introduction

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

Prototype

public static Option create(String opt) throws IllegalArgumentException 

Source Link

Document

Create an Option using the current settings and with the specified Option char.

Usage

From source file:ubc.pavlab.aspiredb.cli.AbstractCLI.java

/**
 * You must implement the handling for this option.
 */// www.  j a  va 2  s  . co  m
protected void addAutoOption() {
    OptionBuilder.withArgName(AUTO_OPTION_NAME);
    OptionBuilder
            .withDescription("Attempt to process entities that need processing based on workflow criteria.");
    Option autoSeekOption = OptionBuilder.create(AUTO_OPTION_NAME);

    addOption(autoSeekOption);
}

From source file:ubc.pavlab.aspiredb.cli.AbstractCLI.java

protected void addDateOption() {
    OptionBuilder.hasArg();//from   w  ww  .j  a  v a  2 s  .  c o m
    OptionBuilder.withArgName("mdate");
    OptionBuilder.withDescription("Constrain to run only on entities with analyses older than the given date. "
            + "For example, to run only on entities that have not been analyzed in the last 10 days, use '-10d'. "
            + "If there is no record of when the analysis was last run, it will be run.");
    Option dateOption = OptionBuilder.create("mdate");

    addOption(dateOption);
}

From source file:ubc.pavlab.aspiredb.cli.AbstractCLI.java

/**
 * Convenience method to add a standard pair of options to intake a host name and port number. *
 * //from w  w w  .  j a  va2s  .  c  o  m
 * @param hostRequired Whether the host name is required
 * @param portRequired Whether the port is required
 */
protected void addHostAndPortOptions(boolean hostRequired, boolean portRequired) {
    OptionBuilder.withArgName("host");
    OptionBuilder.withLongOpt("host");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("Hostname to use (Default = " + DEFAULT_HOST + ")");
    Option hostOpt = OptionBuilder.create(HOST_OPTION);

    hostOpt.setRequired(hostRequired);

    OptionBuilder.withArgName("port");
    OptionBuilder.withLongOpt("port");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("Port to use on host (Default = " + DEFAULT_PORT + ")");
    Option portOpt = OptionBuilder.create(PORT_OPTION);

    portOpt.setRequired(portRequired);

    options.addOption(hostOpt);
    options.addOption(portOpt);
}

From source file:ubc.pavlab.aspiredb.cli.AbstractCLI.java

/**
 * Convenience method to add an option for parallel processing option.
 *//*from  w  w  w.  j  a  va2s .  c  o m*/
protected void addThreadsOption() {
    OptionBuilder.withArgName("numThreads");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("Number of threads to use for batch processing.");
    Option threadsOpt = OptionBuilder.create(THREADS_OPTION);
    options.addOption(threadsOpt);
}

From source file:ubc.pavlab.aspiredb.cli.AbstractCLI.java

/**
 * Convenience method to add a standard pair of (required) options to intake a user name and password, optionally
 * required//  w w w . ja  va  2 s  .co  m
 */
protected void addUserNameAndPasswordOptions(boolean required) {
    OptionBuilder.withArgName("user");
    OptionBuilder.withLongOpt("user");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("User name for accessing the system (optional for some tools)");
    this.usernameOpt = OptionBuilder.create(USERNAME_OPTION);

    usernameOpt.setRequired(required);

    OptionBuilder.withArgName("passwd");
    OptionBuilder.withLongOpt("password");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("Password for accessing the system (optional for some tools)");
    this.passwordOpt = OptionBuilder.create(PASSWORD_CONSTANT);
    passwordOpt.setRequired(required);

    options.addOption(usernameOpt);
    options.addOption(passwordOpt);
}

From source file:ubc.pavlab.aspiredb.cli.AbstractCLI.java

protected void buildStandardOptions() {
    log.debug("Creating standard options");
    Option helpOpt = new Option("h", "help", false, "Print this message");
    Option testOpt = new Option("testing", false, "Use the test environment");
    Option logOpt = new Option("v", "verbosity", true,
            "Set verbosity level (0=silent, 5=very verbose; default is " + DEFAULT_VERBOSITY + ")");
    OptionBuilder.hasArg();/*from   w  w w.  ja v  a 2 s.c  om*/
    OptionBuilder.withArgName("logger");
    OptionBuilder.withDescription(
            "Set the selected logger to the verbosity level after the equals sign. For example, '-logger=org.hibernate.SQL=4'");
    Option otherLogOpt = OptionBuilder.create("logger");

    options.addOption(otherLogOpt);
    options.addOption(logOpt);
    options.addOption(helpOpt);
    options.addOption(testOpt);

}

From source file:ubc.pavlab.aspiredb.cli.DecipherPhenotypeUploadCLI.java

@Override
protected void buildOptions() {
    OptionBuilder.hasArg();/*from ww  w. j a  v a  2 s.c om*/
    OptionBuilder.withArgName("Directory");
    OptionBuilder.withDescription("Directory containing csv files");
    OptionBuilder.withLongOpt("directory");
    Option d = OptionBuilder.create('d');

    OptionBuilder.hasArg();
    OptionBuilder.withArgName("File name");
    OptionBuilder.withDescription("The file to parse");
    OptionBuilder.withLongOpt("filename");
    Option f = OptionBuilder.create('f');

    OptionBuilder.isRequired();
    OptionBuilder.hasArg();
    OptionBuilder.withArgName("Project name");
    OptionBuilder.withDescription(
            "The project where this data will reside. Project will be created if does not exist,"
                    + "If the project does exist use the existingproject option to add to an existing project");
    Option project = OptionBuilder.create("project");

    addOption("existingproject", false, "You must use this option if you are adding to an existing project");

    addOption(d);
    addOption(f);
    addOption(project);
}

From source file:ubc.pavlab.aspiredb.cli.DecipherVariantUploadCLI.java

@Override
protected void buildOptions() {
    OptionBuilder.isRequired();//from w  ww . ja va 2s  .  c  o  m
    OptionBuilder.hasArg();
    OptionBuilder.withArgName("Directory");
    OptionBuilder.withDescription("Directory containing csv files");
    OptionBuilder.withLongOpt("directory");
    Option d = OptionBuilder.create('d');

    OptionBuilder.isRequired();
    OptionBuilder.hasArg();
    OptionBuilder.withArgName("File name");
    OptionBuilder.withDescription("The file to parse");
    OptionBuilder.withLongOpt("filename");
    Option f = OptionBuilder.create('f');

    OptionBuilder.isRequired();
    OptionBuilder.hasArg();
    OptionBuilder.withArgName("Project name");
    OptionBuilder.withDescription(
            "The project where this data will reside. Project will be deleted if existingproject option is not specified,"
                    + "Acceptable values = 'DECIPHER");
    // Decipher will reside in a 'Special project' and are all CNVs
    Option project = OptionBuilder.create("project");

    addOption("existingproject", false, "You must use this option if you are adding to an existing project");

    addOption("dryrun", false, "Use this option to validate your data before uploading");

    addOption(d);
    addOption(f);

    addOption(project);

}

From source file:ubc.pavlab.aspiredb.cli.DGVVariantUploadCLI.java

@Override
protected void buildOptions() {
    OptionBuilder.isRequired();/*from   w w  w  .ja v a2s  . co  m*/
    OptionBuilder.hasArg();
    OptionBuilder.withArgName("Directory");
    OptionBuilder.withDescription("Directory containing csv files");
    OptionBuilder.withLongOpt("directory");
    Option d = OptionBuilder.create('d');

    OptionBuilder.isRequired();
    OptionBuilder.hasArg();
    OptionBuilder.withArgName("File name");
    OptionBuilder.withDescription("The file to parse");
    OptionBuilder.withLongOpt("filename");
    Option f = OptionBuilder.create('f');

    OptionBuilder.isRequired();
    OptionBuilder.hasArg();
    OptionBuilder.withArgName("Project name");
    OptionBuilder.withDescription(
            "The project where this data will reside. Project will be deleted if existingproject option is not specified,"
                    + "Acceptable values = 'DGV");
    // DGV will reside in a 'Special project' and are all CNVs
    /*
     * Option variantType = OptionBuilder.isRequired().hasArg().withArgName( "Variant Type" ) .withDescription(
     * "The type of variant in this file, one of: CNV, Indel, SNV, Inversion" ) .create( "variant" );
     */
    Option project = OptionBuilder.create("project");

    addOption("existingproject", false, "You must use this option if you are adding to an existing project");

    addOption("dryrun", false, "Use this option to validate your data before uploading");

    addOption(d);
    addOption(f);

    addOption(project);

}

From source file:ubc.pavlab.aspiredb.cli.GroupManagerCLI.java

@Override
protected void buildOptions() {

    OptionBuilder.hasArg();//from  ww  w . j a va  2 s .c  o m
    OptionBuilder.withArgName("group name");
    OptionBuilder.withDescription("The group to give permissions to, if it doesn't exist it will be created");
    Option groupname = OptionBuilder.create("groupname");

    OptionBuilder.hasArg();
    OptionBuilder.withArgName("User");
    OptionBuilder.withDescription("The aspiredb user to assign to a group");
    Option aspireuser = OptionBuilder.create("aspireuser");

    OptionBuilder.hasArg();
    OptionBuilder.withArgName("User password");
    OptionBuilder.withDescription("The user password");
    Option aspireuserpassword = OptionBuilder.create("aspireuserpassword");

    OptionBuilder.hasArg();
    OptionBuilder.withArgName("User e-mail");
    OptionBuilder.withDescription("The user email");
    Option aspireuserEmail = OptionBuilder.create("aspireuseremail");

    addOption(groupname);
    addOption(aspireuser);
    addOption(aspireuserpassword);
    addOption(aspireuserEmail);

    addOption("createuser", false,
            "Use this option to create the user, options -aspireuser and -aspireuserpassword and -aspireuseremail required when using this option.");
    addOption("deleteuser", false,
            "Use this option to delete an existing user, option -aspireuser required when using this option.");
    addOption("creategroup", false,
            "Use this option to create a group, option -groupname required when using this option");
    addOption("deletegroup", false,
            "Use this option to delete an existing group, option -groupname required when using this option");
    addOption("assign", false,
            "Using this option will assign a user to a group, options -groupname and -aspireuser required");

    addOption("changepassword", false,
            "Using this option will change an existing user's password, options -aspireuser and -aspireuserpassword and -aspireuseremail required when using this option.");
}