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

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

Introduction

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

Prototype

public void setArgName(String argName) 

Source Link

Document

Sets the display name for the argument value.

Usage

From source file:de.zib.scalaris.Main.java

/**
 * Creates the options the command line should understand.
 * //  w ww .  ja va2  s .  c om
 * @return the options the program understands
 */
private static Options getOptions() {
    Options options = new Options();
    OptionGroup group = new OptionGroup();

    /* Note: arguments are set to be optional since we implement argument
     * checks on our own (commons.cli is not flexible enough and only
     * checks for the existence of a first argument)
     */

    options.addOption(new Option("h", "help", false, "print this message"));

    options.addOption(new Option("v", "verbose", false, "print verbose information, e.g. the properties read"));

    Option read = new Option("r", "read", true, "read an item");
    read.setArgName("key");
    read.setArgs(1);
    read.setOptionalArg(true);
    group.addOption(read);

    Option write = new Option("w", "write", true, "write an item");
    write.setArgName("key> <value");
    write.setArgs(2);
    write.setOptionalArg(true);
    group.addOption(write);

    Option publish = new Option("p", "publish", true, "publish a new message for the given topic");
    publish.setArgName("topic> <message");
    publish.setArgs(2);
    publish.setOptionalArg(true);
    group.addOption(publish);

    Option subscribe = new Option("s", "subscribe", true, "subscribe to a topic");
    subscribe.setArgName("topic> <url");
    subscribe.setArgs(2);
    subscribe.setOptionalArg(true);
    group.addOption(subscribe);

    Option unsubscribe = new Option("u", "unsubscribe", true, "unsubscribe from a topic");
    unsubscribe.setArgName("topic> <url");
    unsubscribe.setArgs(2);
    unsubscribe.setOptionalArg(true);
    group.addOption(unsubscribe);

    Option getSubscribers = new Option("g", "getsubscribers", true, "get subscribers of a topic");
    getSubscribers.setArgName("topic");
    getSubscribers.setArgs(1);
    getSubscribers.setOptionalArg(true);
    group.addOption(getSubscribers);

    Option delete = new Option("d", "delete", true,
            "delete an item (default timeout: 2000ms)\n"
                    + "WARNING: This function can lead to inconsistent data (e.g. "
                    + "deleted items can re-appear). Also when re-creating an item "
                    + "the version before the delete can re-appear.");
    delete.setArgName("key> <[timeout]");
    delete.setArgs(2);
    delete.setOptionalArg(true);
    group.addOption(delete);

    options.addOption(new Option("b", "minibench", false, "run mini benchmark"));

    options.addOption(new Option("lh", "localhost", false,
            "gets the local host's name as known to Java (for debugging purposes)"));

    options.addOptionGroup(group);

    return options;
}

From source file:fr.inria.atlanmod.dag.instantiator.Launcher.java

/**
 * Configures the program options//from  ww  w  .  j  a v a  2 s  .  c  o  m
 *
 * @param options
 */
private static void configureOptions(Options options) {

    Option outDirOpt = OptionBuilder.create(OUTPUT_PATH);
    outDirOpt.setLongOpt(OUTPUT_PATH_LONG);
    outDirOpt.setArgName("neoEMF output uri");
    outDirOpt.setDescription("Output directory (defaults to working dir)");
    outDirOpt.setArgs(1);
    outDirOpt.setRequired(true);

    Option nModelsOpt = OptionBuilder.create(N_MODELS);
    nModelsOpt.setLongOpt(N_MODELS_LONG);
    nModelsOpt.setArgName("models");
    nModelsOpt.setDescription("Number of generated models (defaults to 1)");
    nModelsOpt.setType(Number.class);
    nModelsOpt.setArgs(1);

    Option sizeOption = OptionBuilder.create(SIZE);
    sizeOption.setLongOpt(SIZE_LONG);
    sizeOption.setArgName("size");
    sizeOption.setDescription(MessageFormat.format("Average models'' size (defaults to {0})",
            Launcher.DEFAULT_AVERAGE_MODEL_SIZE));
    sizeOption.setType(Number.class);
    sizeOption.setArgs(1);

    Option densityOption = OptionBuilder.create(VARIATION);
    densityOption.setLongOpt(VARIATION_LONG);
    densityOption.setArgName("proportion");
    densityOption.setDescription(MessageFormat
            .format("Variation ([0..1]) in the models'' size (defaults to {0})", Launcher.DEFAULT_DEVIATION));
    densityOption.setType(Number.class);
    densityOption.setArgs(1);

    Option propVariationOption = OptionBuilder.create(PROP_VARIATION);
    propVariationOption.setLongOpt(PROP_VARIATION_LONG);
    propVariationOption.setArgName("properties deviation");
    propVariationOption.setDescription(MessageFormat.format(
            "Variation ([0..1]) in the properties'' size (defaults to {0})", Launcher.DEFAULT_DEVIATION));
    propVariationOption.setType(Number.class);
    propVariationOption.setArgs(1);

    Option seedOption = OptionBuilder.create(SEED);
    seedOption.setLongOpt(SEED_LONG);
    seedOption.setArgName("seed");
    seedOption.setDescription("Seed number (random by default)");
    seedOption.setType(Number.class);
    seedOption.setArgs(1);

    Option valuesSizeOption = OptionBuilder.create(VALUES_SIZE);
    valuesSizeOption.setLongOpt(VALUES_SIZE_LONG);
    valuesSizeOption.setArgName("size");
    valuesSizeOption.setDescription(MessageFormat.format(
            "Average size for attributes with variable length (defaults to {0}). Actual sizes may vary +/- {1}%.",
            GenericMetamodelConfig.DEFAULT_AVERAGE_VALUES_LENGTH,
            GenericMetamodelConfig.DEFAULT_VALUES_DEVIATION * 100));
    valuesSizeOption.setType(Number.class);
    valuesSizeOption.setArgs(1);

    Option degreeOption = OptionBuilder.create(DEGREE);
    degreeOption.setLongOpt(DEGREE_LONG);
    degreeOption.setArgName("degree");
    degreeOption.setDescription(MessageFormat.format(
            "Average number of references per EObject (defaults to {0}). Actual sizes may vary +/- {1}%.",
            GenericMetamodelConfig.DEFAULT_AVERAGE_REFERENCES_SIZE,
            GenericMetamodelConfig.DEFAULT_REFERENCES_DEVIATION * 100));
    degreeOption.setType(Number.class);
    degreeOption.setArgs(1);

    Option forceOption = OptionBuilder.create(FORCE);
    forceOption.setLongOpt(FORCE_LONG);
    forceOption.setDescription("Force the generation, even if input metamodels contain errors");

    Option diagnoseOption = OptionBuilder.create(DIAGNOSE);
    diagnoseOption.setLongOpt(DIAGNOSE_LONG);
    diagnoseOption.setDescription("Run diagnosis on the result model");

    options.addOption(outDirOpt);
    options.addOption(nModelsOpt);
    options.addOption(sizeOption);
    options.addOption(propVariationOption);
    options.addOption(valuesSizeOption);
    options.addOption(degreeOption);
    options.addOption(seedOption);
    options.addOption(forceOption);
    options.addOption(diagnoseOption);
    options.addOption(densityOption);
}

From source file:com.twitter.hraven.etl.JobFilePreprocessor.java

/**
 * Parse command-line arguments./*from   w  w  w  .  j  a  va  2 s. c o  m*/
 * 
 * @param args
 *          command line arguments passed to program.
 * @return parsed command line.
 * @throws ParseException
 */
private static CommandLine parseArgs(String[] args) throws ParseException {
    Options options = new Options();

    // Cluster
    Option o = new Option("c", "cluster", true, "cluster for which jobs are processed");
    o.setArgName("cluster");
    o.setRequired(true);
    options.addOption(o);

    // Input
    o = new Option("o", "output", true, "output directory in hdfs. This is where the index files are written.");
    o.setArgName("output-path");
    o.setRequired(true);
    options.addOption(o);

    // Input
    o = new Option("i", "input", true,
            "input directory in hdfs. Default is mapred.job.tracker.history.completed.location.");
    o.setArgName("input-path");
    o.setRequired(false);
    options.addOption(o);

    // Batch
    o = new Option("b", "batchSize", true,
            "The number of files to process in one batch. Default " + DEFAULT_BATCH_SIZE);
    o.setArgName("batch-size");
    o.setRequired(false);
    options.addOption(o);

    // raw file size limit
    o = new Option("s", "rawFileSize", true,
            "The max size of file that can be loaded into raw table. Default " + DEFAULT_RAW_FILE_SIZE_LIMIT);
    o.setArgName("rawfile-size");
    o.setRequired(false);
    options.addOption(o);

    // Force
    o = new Option("f", "forceAllFiles", false,
            "Force all files in a directory to be processed, no matter the previous processingRecord. Default: false. Usefull for batch loads.");
    o.setRequired(false);
    options.addOption(o);

    // Debugging
    options.addOption("d", "debug", false, "switch on DEBUG log level");

    CommandLineParser parser = new PosixParser();
    CommandLine commandLine = null;
    try {
        commandLine = parser.parse(options, args);
    } catch (Exception e) {
        System.err.println("ERROR: " + e.getMessage() + "\n");
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(NAME + " ", options, true);
        System.exit(-1);
    }

    // Set debug level right away
    if (commandLine.hasOption("d")) {
        Logger log = Logger.getLogger(JobFileRawLoader.class);
        log.setLevel(Level.DEBUG);
    }

    return commandLine;
}

From source file:com.opengamma.integration.viewer.status.ViewStatusOption.java

/**
 * Creates command line options// w ww . java2 s .  co  m
 * 
 * @return the command line options, not-null.
 */
public static Options createOptions() {

    Options options = new Options();

    Option portfolioNameOption = new Option(PORTFOLIO_NAME_OPT, "name", true,
            "the name of the source OpenGamma portfolio");
    portfolioNameOption.setArgName("portfolioName");
    portfolioNameOption.setRequired(true);

    Option userOption = new Option(USER_OPT, "user", true, "the username/ipaddress for computing views");
    userOption.setArgName("username/ipaddress");

    Option formatTypeOption = new Option(FORMAT_TYPE_OPT, "format", true,
            "the format of status result, default is html");
    formatTypeOption.setArgName("csv, xml, html");

    Option aggregationTypeOption = new Option(AGGREGATION_TYPE_OPT, "aggregate", true,
            "the aggregation type of result, default is no-aggregation");
    aggregationTypeOption.setArgName("TSVC, CSVT");

    Option outputOption = new Option(OUTPUT_OPT, "output", true, "the output filename");
    outputOption.setArgName("filePath");

    Option liveMarketDataOption = new Option(LIVE_MARKET_DATA_OPT, "live", true,
            "the live marketdata datasource");
    liveMarketDataOption.setArgName("datasource");

    Option userMarketDataOption = new Option(USER_MARKET_DATA_OPT, "snapshot", true,
            "the user marketdata snapshot name");
    userMarketDataOption.setArgName("snapshot name");

    Option historicalMarketDataOption = new Option(HISTORICAL_MARKET_DATA_OPT, "historical", true,
            "the historical marketdata specification");
    historicalMarketDataOption.setArgName("localdate/htsKey");

    options.addOption(portfolioNameOption);
    options.addOption(userOption);
    options.addOption(formatTypeOption);
    options.addOption(aggregationTypeOption);
    options.addOption(outputOption);
    options.addOption(liveMarketDataOption);
    options.addOption(userMarketDataOption);
    options.addOption(historicalMarketDataOption);

    return options;
}

From source file:fr.inria.atlanmod.instantiator.neoEMF.Launcher.java

/**
 * Configures the program options// w  w w.  j  av  a 2 s  .co m
 *
 * @param options
 */
private static void configureOptions(Options options) {
    Option metamodelOpt = OptionBuilder.create(E_PACKAGE_CLASS);
    metamodelOpt.setLongOpt(E_PACKAGE_CLASS_LONG);
    metamodelOpt.setArgName("path to the ePackage implementation");
    metamodelOpt.setDescription("PackgeImpl");
    metamodelOpt.setArgs(1);
    metamodelOpt.setRequired(true);

    Option outDirOpt = OptionBuilder.create(OUTPUT_PATH);
    outDirOpt.setLongOpt(OUTPUT_PATH_LONG);
    outDirOpt.setArgName("neoEMF output uri");
    outDirOpt.setDescription("Output directory (defaults to working dir)");
    outDirOpt.setArgs(1);
    outDirOpt.setRequired(true);

    Option nModelsOpt = OptionBuilder.create(N_MODELS);
    nModelsOpt.setLongOpt(N_MODELS_LONG);
    nModelsOpt.setArgName("models");
    nModelsOpt.setDescription("Number of generated models (defaults to 1)");
    nModelsOpt.setType(Number.class);
    nModelsOpt.setArgs(1);

    Option sizeOption = OptionBuilder.create(SIZE);
    sizeOption.setLongOpt(SIZE_LONG);
    sizeOption.setArgName("size");
    sizeOption.setDescription(MessageFormat.format("Average models'' size (defaults to {0})",
            Launcher.DEFAULT_AVERAGE_MODEL_SIZE));
    sizeOption.setType(Number.class);
    sizeOption.setArgs(1);

    Option variationOption = OptionBuilder.create(VARIATION);
    variationOption.setLongOpt(VARIATION_LONG);
    variationOption.setArgName("proportion");
    variationOption.setDescription(MessageFormat
            .format("Variation ([0..1]) in the models'' size (defaults to {0})", Launcher.DEFAULT_DEVIATION));
    variationOption.setType(Number.class);
    variationOption.setArgs(1);

    Option propVariationOption = OptionBuilder.create(PROP_VARIATION);
    propVariationOption.setLongOpt(PROP_VARIATION_LONG);
    propVariationOption.setArgName("properties deviation");
    propVariationOption.setDescription(MessageFormat.format(
            "Variation ([0..1]) in the properties'' size (defaults to {0})", Launcher.DEFAULT_DEVIATION));
    propVariationOption.setType(Number.class);
    propVariationOption.setArgs(1);

    Option seedOption = OptionBuilder.create(SEED);
    seedOption.setLongOpt(SEED_LONG);
    seedOption.setArgName("seed");
    seedOption.setDescription("Seed number (random by default)");
    seedOption.setType(Number.class);
    seedOption.setArgs(1);

    Option valuesSizeOption = OptionBuilder.create(VALUES_SIZE);
    valuesSizeOption.setLongOpt(VALUES_SIZE_LONG);
    valuesSizeOption.setArgName("size");
    valuesSizeOption.setDescription(MessageFormat.format(
            "Average size for attributes with variable length (defaults to {0}). Actual sizes may vary +/- {1}%.",
            GenericMetamodelConfig.DEFAULT_AVERAGE_VALUES_LENGTH,
            GenericMetamodelConfig.DEFAULT_VALUES_DEVIATION * 100));
    valuesSizeOption.setType(Number.class);
    valuesSizeOption.setArgs(1);

    Option degreeOption = OptionBuilder.create(DEGREE);
    degreeOption.setLongOpt(DEGREE_LONG);
    degreeOption.setArgName("degree");
    degreeOption.setDescription(MessageFormat.format(
            "Average number of references per EObject (defaults to {0}). Actual sizes may vary +/- {1}%.",
            GenericMetamodelConfig.DEFAULT_AVERAGE_REFERENCES_SIZE,
            GenericMetamodelConfig.DEFAULT_REFERENCES_DEVIATION * 100));
    degreeOption.setType(Number.class);
    degreeOption.setArgs(1);

    Option forceOption = OptionBuilder.create(FORCE);
    forceOption.setLongOpt(FORCE_LONG);
    forceOption.setDescription("Force the generation, even if input metamodels contain errors");

    Option diagnoseOption = OptionBuilder.create(DIAGNOSE);
    diagnoseOption.setLongOpt(DIAGNOSE_LONG);
    diagnoseOption.setDescription("Run diagnosis on the result model");

    options.addOption(metamodelOpt);
    options.addOption(outDirOpt);
    options.addOption(nModelsOpt);
    options.addOption(sizeOption);
    options.addOption(variationOption);
    options.addOption(propVariationOption);
    options.addOption(valuesSizeOption);
    options.addOption(degreeOption);
    options.addOption(seedOption);
    options.addOption(forceOption);
    options.addOption(diagnoseOption);
}

From source file:de.uni_koblenz.jgralab.utilities.tgraphbrowser.TGraphBrowserServer.java

/**
 * Processes the command line options./*from ww  w.j  a va  2s. c  o m*/
 * 
 * @param args
 * @return
 */
private static CommandLine processCommandLineOptions(String[] args) {
    String toolString = "java " + TGraphBrowserServer.class.getName();
    String versionString = getInfo();
    OptionHandler oh = new OptionHandler(toolString, versionString);

    Option output = new Option("w", "workspace", true,
            "(optional): the workspace. Default is $temp$/tgraphbrowser/workspace");
    output.setRequired(false);
    output.setArgName("path");
    oh.addOption(output);

    Option stateTimeout = new Option("t", "state_timeout", true, "(optional): resources are freed, "
            + "if they were not used in the last <given> seconds." + " Default value is 600 sec.");
    stateTimeout.setRequired(false);
    stateTimeout.setArgName("sec");
    oh.addOption(stateTimeout);

    Option checkInterval = new Option("ci", "check_interval", true,
            "(optional): the interval in sec after which the states"
                    + " are checked, if thex are to old. Default value is 60 sec.");
    checkInterval.setRequired(false);
    checkInterval.setArgName("sec");
    oh.addOption(checkInterval);

    Option timeToCreateDot = new Option("td", "time_for_dot", true,
            "(optional): the interval in sec after which the execution of dot is aborted."
                    + " Default value is 60 sec.");
    timeToCreateDot.setRequired(false);
    timeToCreateDot.setArgName("sec");
    oh.addOption(timeToCreateDot);

    Option port = new Option("p", "port", true, "(optional): the port of the server. Default is port 8080.");
    port.setRequired(false);
    port.setArgName("portnumber");
    oh.addOption(port);

    Option incidences = new Option("i", "incidences", true,
            "(optional): number of incident edges which are" + " shown in the table view. Default is 10.");
    incidences.setRequired(false);
    incidences.setArgName("int");
    oh.addOption(incidences);

    Option dot = new Option("d", "dot", true,
            "(optional): the command to call dot." + " If it is not set, the 2D-view won't be available.");
    dot.setRequired(false);
    dot.setArgName("command");
    oh.addOption(dot);

    Option maxSize = new Option("m", "maximum_filesize", true,
            "(optional): the maximum size of a tg-file which is loaded in MB");
    maxSize.setRequired(false);
    maxSize.setArgName("int");
    oh.addOption(maxSize);

    Option size = new Option("s", "size_of_workspace", true,
            "(optional): the maximum size of the workspace in MB." + " Newly submitted tg.-files are rejected,"
                    + " if maximumSizeOfWorkspace < currentSizeOfWorkspace + sizeOfSubmittedTgFile ");
    size.setRequired(false);
    size.setArgName("int");
    oh.addOption(size);

    Option roleNames = new Option("r", "print-role-names", false,
            "(optional): Print role names in the 2D view.  Defaults to false.");
    roleNames.setRequired(false);
    oh.addOption(roleNames);

    return oh.parse(args);
}

From source file:de.unibi.techfak.bibiserv.util.codegen.Main.java

/**
 * Returns "Choice" optiongroup for CodeGeneration.
 *
 * @return//from  w w w.jav  a2 s. c o  m
 */
private static OptionGroup getCMDLineOptionsGroups() {
    OptionGroup optionsgroup = new OptionGroup();
    optionsgroup.setRequired(true);
    Option generate = new Option("g", "generate", true, "Generate app from xml description.");
    generate.setArgName("runnableitem.xml");
    optionsgroup.addOption(new Option("V", "version", false, "version"))
            .addOption(new Option("h", "help", false, "help")).addOption(generate);

    return optionsgroup;
}

From source file:com.linkedin.helix.examples.BootstrapProcess.java

@SuppressWarnings("static-access")
private static Options constructCommandLineOptions() {
    Option helpOption = OptionBuilder.withLongOpt(help).withDescription("Prints command-line options info")
            .create();/*w  ww.  ja  v a2  s  .c om*/

    Option zkServerOption = OptionBuilder.withLongOpt(zkServer).withDescription("Provide zookeeper address")
            .create();
    zkServerOption.setArgs(1);
    zkServerOption.setRequired(true);
    zkServerOption.setArgName("ZookeeperServerAddress(Required)");

    Option clusterOption = OptionBuilder.withLongOpt(cluster).withDescription("Provide cluster name").create();
    clusterOption.setArgs(1);
    clusterOption.setRequired(true);
    clusterOption.setArgName("Cluster name (Required)");

    Option hostOption = OptionBuilder.withLongOpt(hostAddress).withDescription("Provide host name").create();
    hostOption.setArgs(1);
    hostOption.setRequired(true);
    hostOption.setArgName("Host name (Required)");

    Option portOption = OptionBuilder.withLongOpt(hostPort).withDescription("Provide host port").create();
    portOption.setArgs(1);
    portOption.setRequired(true);
    portOption.setArgName("Host port (Required)");

    Option stateModelOption = OptionBuilder.withLongOpt(stateModel).withDescription("StateModel Type").create();
    stateModelOption.setArgs(1);
    stateModelOption.setRequired(true);
    stateModelOption.setArgName("StateModel Type (Required)");

    // add an option group including either --zkSvr or --configFile
    Option fileOption = OptionBuilder.withLongOpt(configFile)
            .withDescription("Provide file to read states/messages").create();
    fileOption.setArgs(1);
    fileOption.setRequired(true);
    fileOption.setArgName("File to read states/messages (Optional)");

    Option transDelayOption = OptionBuilder.withLongOpt(transDelay).withDescription("Provide state trans delay")
            .create();
    transDelayOption.setArgs(1);
    transDelayOption.setRequired(false);
    transDelayOption.setArgName("Delay time in state transition, in MS");

    OptionGroup optionGroup = new OptionGroup();
    optionGroup.addOption(zkServerOption);
    optionGroup.addOption(fileOption);

    Options options = new Options();
    options.addOption(helpOption);
    // options.addOption(zkServerOption);
    options.addOption(clusterOption);
    options.addOption(hostOption);
    options.addOption(portOption);
    options.addOption(stateModelOption);
    options.addOption(transDelayOption);

    options.addOptionGroup(optionGroup);

    return options;
}

From source file:de.iew.imageread.Main.java

protected static Options setupOptions() {
    Options options = new Options();

    Option imageOutputDirOption = new Option("o", "outputDir", true,
            "The base directory to write the images to (Default: system temp directory)");
    imageOutputDirOption.setArgName("outputDir");

    Option imageFilenamePrefixOption = new Option("p", "filenamePrefix", true,
            "The basename/prefix for each image (Default: image-)");
    imageFilenamePrefixOption.setArgName("filenamePrefix");

    Option groupingOutputOption = new Option("g", "groupingOutput", true,
            "Grouping option for the images; valid values are ALL, GROUP_BY_DAY (Default: ALL)");
    groupingOutputOption.setArgName("groupingOutput");
    groupingOutputOption.setType(OUTPUT_OPTION.class);

    Option queryOption = new Option("q", "query", true,
            "Query filters for the mongo db queries; valid values for 'query' are FROM, TO and EXACT (Default: no specific query)");
    queryOption.setArgs(2);//  w  ww  . j a v a 2  s.c  o  m
    queryOption.setArgName("query=date");
    queryOption.setValueSeparator('=');

    Option databaseOption = new Option("md", "database", true, "The mongo db database (Default: test)");
    databaseOption.setArgName("database");

    Option mongodbHostOption = new Option("mh", "hostname", true,
            "The hostname of the mongo db instance (Default: localhost)");
    mongodbHostOption.setArgName("hostname");

    Option mongodbPortOption = new Option("mp", "port", true,
            "The port of the mongo db instance (Default: 27017)");
    mongodbPortOption.setArgName("port");
    mongodbPortOption.setType(Integer.TYPE);

    Option printHelpOption = new Option("h", "help", false, "Print help");

    options.addOption(imageOutputDirOption);
    options.addOption(imageFilenamePrefixOption);
    options.addOption(groupingOutputOption);
    options.addOption(queryOption);
    options.addOption(databaseOption);
    options.addOption(mongodbHostOption);
    options.addOption(mongodbPortOption);

    options.addOption(printHelpOption);

    return options;
}

From source file:com.twitter.hraven.etl.JobFilePartitioner.java

/**
 * Parse command-line arguments./*ww w . j av a 2 s . c o m*/
 * 
 * @param args
 *          command line arguments passed to program.
 * @return parsed command line.
 * @throws ParseException
 */
private static CommandLine parseArgs(String[] args) throws ParseException {
    Options options = new Options();

    // Input
    Option o = new Option("i", "input", true, "input directory as hdfs path, or local as file://");
    o.setArgName("input-path");
    o.setRequired(true);
    options.addOption(o);

    // Input
    o = new Option("o", "output", true, "output directory");
    o.setArgName("input-path");
    o.setRequired(true);
    options.addOption(o);

    // Whether to skip existing files or not.
    o = new Option("s", "skipExisting", false, "skip existing files. Cannot be used together with m for move.");
    o.setRequired(false);
    options.addOption(o);

    // Maximum number of files to retain in the specified input directory.
    o = new Option("x", "maXretention", true,
            "The maximum number of the most recent files to retain in the input directory after processing."
                    + " Can be used by HDFS input paths only. Mutually exclusive with s (move),"
                    + " but can be used in combination with s (skipExisting)");
    o.setRequired(false);
    options.addOption(o);

    // Whether files need to be moved
    o = new Option("m", "move", false,
            "move all files rather than copying." + "Delete source if target already exists."
                    + " Can be used with HDFS input paths only. " + " Mutually exlusive with s (skipExisting)");
    o.setRequired(false);
    options.addOption(o);

    // Debugging
    options.addOption("d", "debug", false, "switch on DEBUG log level");
    o.setRequired(false);
    options.addOption(o);

    CommandLineParser parser = new PosixParser();
    CommandLine commandLine = null;
    try {
        commandLine = parser.parse(options, args);
    } catch (Exception e) {
        System.err.println("ERROR: " + e.getMessage() + "\n");
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(NAME + " ", options, true);
        System.exit(-1);
    }

    return commandLine;
}