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:org.apache.usergrid.tools.ExportApp.java

@Override
@SuppressWarnings("static-access")
public Options createOptions() {

    Options options = super.createOptions();

    Option appNameOption = OptionBuilder.hasArg().withType("")
            .withDescription("Application Name -" + APPLICATION_NAME).create(APPLICATION_NAME);
    options.addOption(appNameOption);//from  w  w w  .jav a 2  s .co m

    Option writeThreadsOption = OptionBuilder.hasArg().withType(0)
            .withDescription("Write Threads -" + WRITE_THREAD_COUNT).create(WRITE_THREAD_COUNT);
    options.addOption(writeThreadsOption);

    return options;
}

From source file:org.apache.usergrid.tools.ExportDataCreator.java

@Override
@SuppressWarnings("static-access")
public Options createOptions() {

    Options options = super.createOptions();

    Option appName = OptionBuilder.hasArg().withDescription("Application name to use").create(APP_NAME);

    Option orgName = OptionBuilder.hasArg().withDescription("Organization to use (will create if not present)")
            .create(ORG_NAME);//from  w ww.jav  a 2s.  c  o  m

    Option numUsers = OptionBuilder.hasArg().withDescription("Number of users create (in addition to users)")
            .create(NUM_USERS);

    Option numCollection = OptionBuilder.hasArg()
            .withDescription("Number of collections to create (in addition to users)").create(NUM_COLLECTIONS);

    Option numEntities = OptionBuilder.hasArg().withDescription("Number of entities to create per collection")
            .create(NUM_ENTITIES);

    Option adminUsername = OptionBuilder.hasArg().withDescription("Admin Username").create(ADMIN_USERNAME);

    Option adminPassword = OptionBuilder.hasArg().withDescription("Admin Password").create(ADMIN_PASSWORD);

    options.addOption(appName);
    options.addOption(orgName);
    options.addOption(numUsers);
    options.addOption(numCollection);
    options.addOption(numEntities);
    options.addOption(adminUsername);
    options.addOption(adminPassword);

    return options;
}

From source file:org.apache.usergrid.tools.ExportingToolBase.java

@Override
@SuppressWarnings("static-access")
public Options createOptions() {

    Options options = super.createOptions();

    Option outputDir = OptionBuilder.hasArg().withDescription("output file name -outputDir").create(OUTPUT_DIR);
    Option orgId = OptionBuilder.hasArg().withDescription("Use a specific organization -orgId").create("orgId");

    options.addOption(outputDir);/*from  w  ww.  j  a v a2  s  .c  o  m*/
    options.addOption(orgId);

    return options;
}

From source file:org.apache.usergrid.tools.Import.java

@Override
@SuppressWarnings("static-access")
public Options createOptions() {

    Option hostOption = OptionBuilder.withArgName("host").hasArg().withDescription("Cassandra host")
            .create("host");

    Option inputDir = OptionBuilder.hasArg().withDescription("input directory -inputDir").create(INPUT_DIR);

    Option verbose = OptionBuilder
            .withDescription("Print on the console an echo of the content written to the file").create(VERBOSE);

    Options options = new Options();
    options.addOption(hostOption);//w w  w.j  a v a2s  . c om
    options.addOption(inputDir);
    options.addOption(verbose);

    return options;
}

From source file:org.apache.usergrid.tools.ImportAdmins.java

@Override
@SuppressWarnings("static-access")
public Options createOptions() {

    // inherit parent options
    Options options = super.createOptions();

    Option inputDir = OptionBuilder.hasArg().withDescription("input directory -inputDir").create(INPUT_DIR);

    Option writeThreads = OptionBuilder.hasArg().withDescription("Write Threads -writeThreads")
            .create(WRITE_THREAD_COUNT);

    Option auditThreads = OptionBuilder.hasArg().withDescription("Audit Threads -auditThreads")
            .create(AUDIT_THREAD_COUNT);

    Option verbose = OptionBuilder
            .withDescription("Print on the console an echo of the content written to the file").create(VERBOSE);

    options.addOption(writeThreads);//  w w  w. jav a  2s  .  co  m
    options.addOption(auditThreads);
    options.addOption(inputDir);
    options.addOption(verbose);

    return options;
}

From source file:org.apache.usergrid.tools.Metrics.java

@Override
public Options createOptions() {
    Options options = super.createOptions();
    Option duration = OptionBuilder.hasArg()
            .withDescription("A duration signifying the previous time until now. "
                    + "Supported forms: h,m,d eg. '30d' would be 30 days")
            .create("duration");
    Option startDate = OptionBuilder.hasArg().withDescription("The start date of the report")
            .create("startDate");
    Option endDate = OptionBuilder.hasArg().withDescription("The end date of the report").create("endDate");

    options.addOption(duration).addOption(endDate).addOption(startDate);

    return options;
}

From source file:org.apache.usergrid.tools.WarehouseExport.java

@Override
@SuppressWarnings("static-access")
public Options createOptions() {

    Options options = super.createOptions();

    Option startTime = OptionBuilder.hasArg().withDescription("minimum modified time -startTime")
            .create(START_TIME);// w w w .  j  a  v a 2  s .c  o  m

    Option endTime = OptionBuilder.hasArg().withDescription("maximum modified time -endTime").create(END_TIME);

    Option upload = OptionBuilder.withDescription("upload files to blob-store").create(UPLOAD);

    options.addOption(startTime);
    options.addOption(endTime);
    options.addOption(upload);

    return options;
}

From source file:org.clinigrid.capillary.inspector.Inspector.java

private static CommandLine parse(String[] args) {
    Options opts = new Options();

    OptionBuilder.withArgName("external-model-uris");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("set the paths of the external model URIs to import (semi-colon separated)");
    opts.addOption(OptionBuilder.create("i"));

    OptionBuilder.withArgName("jar-file-path");
    OptionBuilder.hasArg();//  w  ww .  j  a va  2 s .com
    OptionBuilder
            .withDescription("set the path of the archive file (jar or war) to scan (semi-colon separated)");
    opts.addOption(OptionBuilder.create("j"));

    OptionBuilder.withArgName("dependency-jar");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("set the paths of the dependency archives (semi-colon separated)");
    opts.addOption(OptionBuilder.create("d"));

    OptionBuilder.withArgName("output-file.ecore");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("set the output ecore file name");
    opts.addOption(OptionBuilder.create("o"));

    opts.addOption("v", "verbose", false, "set the verbose mode");

    opts.addOption("h", "help", false, "print this message");
    opts.addOption("V", "version", false, "print the version information and exit");
    CommandLine cl = null;
    try {
        cl = new GnuParser().parse(opts, args);
    } catch (ParseException e) {
        exit("dcmmwl: " + e.getMessage());
        throw new RuntimeException("unreachable");
    }
    if (cl.hasOption('V')) {
        Package p = Inspector.class.getPackage();
        System.out.println("Capillary v" + p.getImplementationVersion());
        System.exit(0);
    }
    if (cl.hasOption('h') /*|| cl.getArgList().size() != 1*/) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(USAGE, DESCRIPTION, opts, EXAMPLE);
        System.exit(0);
    }

    return cl;
}

From source file:org.codehaus.groovy.tools.FileSystemCompiler.java

@SuppressWarnings({ "AccessStaticViaInstance" })
public static Options createCompilationOptions() {
    ///*from ww w. ja v a 2 s  .co  m*/
    // Parse the command line

    Options options = new Options();

    options.addOption(OptionBuilder.hasArg().withArgName("path")
            .withDescription("Specify where to find the class files - must be first argument")
            .create("classpath"));
    options.addOption(OptionBuilder.withLongOpt("classpath").hasArg().withArgName("path")
            .withDescription("Aliases for '-classpath'").create("cp"));
    options.addOption(OptionBuilder.withLongOpt("sourcepath").hasArg().withArgName("path")
            .withDescription("Specify where to find the source files").create());
    options.addOption(OptionBuilder.withLongOpt("temp").hasArg().withArgName("temp")
            .withDescription("Specify temporary directory").create());
    options.addOption(OptionBuilder.withLongOpt("encoding").hasArg().withArgName("encoding")
            .withDescription("Specify the encoding of the user class files").create());
    options.addOption(
            OptionBuilder.hasArg().withDescription("Specify where to place generated class files").create('d'));
    //            options.addOption(OptionBuilder.withLongOpt("strict").withDescription("Turn on strict type safety.").create('s'));
    options.addOption(OptionBuilder.withLongOpt("help").withDescription("Print a synopsis of standard options")
            .create('h'));
    options.addOption(OptionBuilder.withLongOpt("version").withDescription("Print the version").create('v'));
    options.addOption(
            OptionBuilder.withLongOpt("exception").withDescription("Print stack trace on error").create('e'));
    options.addOption(OptionBuilder.withLongOpt("jointCompilation")
            .withDescription("Attach javac compiler to compile .java files").create('j'));
    options.addOption(OptionBuilder.withLongOpt("basescript").hasArg().withArgName("class")
            .withDescription("Base class name for scripts (must derive from Script)").create('b'));

    options.addOption(OptionBuilder.withArgName("property=value").withValueSeparator().hasArgs(2)
            .withDescription("name-value pairs to pass to javac").create("J"));
    options.addOption(OptionBuilder.withArgName("flag").hasArg()
            .withDescription("passed to javac for joint compilation").create("F"));

    options.addOption(OptionBuilder.withLongOpt("indy")
            .withDescription("enables compilation using invokedynamic").create());
    options.addOption(OptionBuilder.withLongOpt("configscript").hasArg()
            .withDescription("A script for tweaking the configuration options").create());
    return options;
}

From source file:org.controlhaus.webservice.generator.ExtensionMaker.java

private static Options buildOptions() {
    Options options = new Options();
    OptionBuilder.hasArg();
    OptionBuilder.withArgName("dir");
    OptionBuilder.withDescription("Base directory of the wsdl file(s)");
    OptionBuilder.isRequired(true);//from w  w w  . j  ava  2 s  .  c  o m
    Option option = OptionBuilder.create("wsdl");
    options.addOption(option);

    OptionBuilder.hasArg();
    OptionBuilder.withArgName("dir");
    OptionBuilder.withDescription("Root directory for the jcx file.");
    OptionBuilder.isRequired(true);
    option = OptionBuilder.create("gen_root");
    options.addOption(option);

    //        OptionBuilder.hasArg();
    //        OptionBuilder.withArgName("URL");
    //        OptionBuilder.withDescription("URL to the web service.");
    //        option = OptionBuilder.create("serviceURL");
    //        OptionBuilder.isRequired(false); // if specified, it will overwrite
    //                                            // the one in WSDL
    //        options.addOption(option);

    OptionBuilder.hasArg();
    OptionBuilder.withArgName("dir");
    OptionBuilder.isRequired(false);
    OptionBuilder.withDescription("path annotation to use in the jcx");
    option = OptionBuilder.create("wsdl_path_annotation");
    options.addOption(option);

    OptionBuilder.hasArg();
    OptionBuilder.withArgName("package_name");
    OptionBuilder.isRequired(false);
    OptionBuilder.withDescription("Package name of the jcx");
    option = OptionBuilder.create("pkg");
    options.addOption(option);

    return options;
}