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

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

Introduction

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

Prototype

public static OptionBuilder withArgName(String name) 

Source Link

Document

The next Option created will have the specified argument value name.

Usage

From source file:edu.umd.honghongie.BuildPersonalizedPageRankRecords.java

/**
 * Runs this tool./*  ww  w . java2  s  .c  o  m*/
 */

@SuppressWarnings({ "static-access" })
public int run(String[] args) throws Exception {
    Options options = new Options();

    options.addOption(OptionBuilder.withArgName("path").hasArg().withDescription("input path").create(INPUT));
    options.addOption(OptionBuilder.withArgName("path").hasArg().withDescription("output path").create(OUTPUT));
    options.addOption(
            OptionBuilder.withArgName("num").hasArg().withDescription("number of nodes").create(NUM_NODES));
    options.addOption(OptionBuilder.withArgName("node").hasArg()
            .withDescription("source node (i.e., destination of the random jump)").create(SOURCE));

    CommandLine cmdline;
    CommandLineParser parser = new GnuParser();

    try {
        cmdline = parser.parse(options, args);
    } catch (ParseException exp) {
        System.err.println("Error parsing command line: " + exp.getMessage());
        return -1;
    }

    if (!cmdline.hasOption(INPUT) || !cmdline.hasOption(OUTPUT) || !cmdline.hasOption(NUM_NODES)
            || !cmdline.hasOption(SOURCE)) {
        System.out.println("args: " + Arrays.toString(args));
        HelpFormatter formatter = new HelpFormatter();
        formatter.setWidth(120);
        formatter.printHelp(this.getClass().getName(), options);
        ToolRunner.printGenericCommandUsage(System.out);
        return -1;
    }

    String inputPath = cmdline.getOptionValue(INPUT);
    String outputPath = cmdline.getOptionValue(OUTPUT);
    int n = Integer.parseInt(cmdline.getOptionValue(NUM_NODES));
    String source = cmdline.getOptionValue(SOURCE); //get source information from cmdline

    LOG.info("Tool name: " + BuildPersonalizedPageRankRecords.class.getSimpleName());
    LOG.info(" - inputDir: " + inputPath);
    LOG.info(" - outputDir: " + outputPath);
    LOG.info(" - numNodes: " + n);
    LOG.info(" - source: " + source);

    Configuration conf = getConf();
    conf.setInt(NODE_CNT_FIELD, n);
    conf.setInt("mapred.min.split.size", 1024 * 1024 * 1024);
    conf.set(SOURCE_NODES, source); //set source node and pass it to mapper setup

    Job job = Job.getInstance(conf);
    job.setJobName(BuildPersonalizedPageRankRecords.class.getSimpleName() + ":" + inputPath);
    job.setJarByClass(BuildPersonalizedPageRankRecords.class);

    job.setNumReduceTasks(0);

    FileInputFormat.addInputPath(job, new Path(inputPath));
    FileOutputFormat.setOutputPath(job, new Path(outputPath));

    job.setInputFormatClass(TextInputFormat.class);
    job.setOutputFormatClass(SequenceFileOutputFormat.class);

    job.setMapOutputKeyClass(IntWritable.class);
    job.setMapOutputValueClass(PageRankNode.class);

    job.setOutputKeyClass(IntWritable.class);
    job.setOutputValueClass(PageRankNode.class);

    job.setMapperClass(MyMapper.class);

    // Delete the output directory if it exists already.
    FileSystem.get(conf).delete(new Path(outputPath), true);

    job.waitForCompletion(true);

    return 0;
}

From source file:com.redhat.rhn.taskomatic.core.TaskomaticDaemon.java

private void createOption(Options accum, String longopt, boolean arg, String argName, String description) {
    OptionBuilder.withArgName(argName);
    OptionBuilder.withLongOpt(longopt);//from  w  ww  .j av  a 2  s  . c  o m
    OptionBuilder.hasArg(arg);
    OptionBuilder.withDescription(description);
    Option option = OptionBuilder.create(longopt);
    accum.addOption(option);
    if (this.masterOptionsMap.get(longopt) == null) {
        this.masterOptionsMap.put(longopt, option);
    }
}

From source file:com.symbian.utils.cmdline.CmdLine.java

/**
 * Adds a switch to a command./*from ww  w  . j a  v a2  s  .co  m*/
 * 
 * @param aSwitchName
 *            name of the switch
 * @param aIsSingle
 *            If the switch is single.
 * @param aDescription
 *            description of the switch (for help command)
 * @param aIsMandatory
 *            make switch mandatory
 * @param aDataCheck
 *            facility to check the validity of the parameter.
 */
public synchronized void addSwitch(final String aSwitchName, final boolean aIsSingle, final String aDescription,
        final boolean aIsMandatory, final DataAcceptable aDataCheck) {

    Option lOption = null;

    OptionBuilder.withArgName(aSwitchName);
    OptionBuilder.withDescription(aDescription);
    OptionBuilder.isRequired(aIsMandatory);
    OptionBuilder.hasArg(aDataCheck != null);

    if (!aIsSingle) {
        OptionBuilder.withLongOpt(aSwitchName);
        lOption = OptionBuilder.create();
    } else {
        lOption = OptionBuilder.create(aSwitchName);
    }

    if (aDataCheck != null) {
        iParametersToCheck.add(aSwitchName);
        iParametersChecks.add(aDataCheck);
    }
    iOptions.addOption(lOption);
}

From source file:com.boundary.sdk.event.EventCLI.java

@SuppressWarnings("static-access")
private void addPropertiesOption() {
    optionProperties = OptionBuilder.withArgName("key:value[,key:value]").hasArg()
            .withDescription("Properties for the event.").hasArgs(2).withValueSeparator()
            .withLongOpt("properties").create(OPTION_PROPERTIES);
    options.addOption(optionProperties);
}

From source file:com.github.cojac.Arg.java

@SuppressWarnings("static-access")
static Options createOptions() {
    Options options = new Options();

    options.addOption(Arg.HELP.shortOpt(), "help", false, "Print the help of the program and exit");
    options.addOption(Arg.VERBOSE.shortOpt(), "verbose", false, "Display some internal traces");
    options.addOption(Arg.PRINT.shortOpt(), "console", false,
            "Signal problems with console messages to stderr (default signaling policy)");
    options.addOption(Arg.EXCEPTION.shortOpt(), "exception", false,
            "Signal problems by throwing an ArithmeticException");
    options.addOption(OptionBuilder.withLongOpt("callback").withArgName("meth").hasArg()
            .withDescription("Signal problems by calling " + "a user-supplied method matching this signature:"
                    + "\n...public static void f(String msg) \n"
                    + "(Give a fully qualified identifier in the form: \n" + "pkgA/myPkg/myClass/myMethod)")
            .create(Arg.CALL_BACK.shortOpt()));
    options.addOption(OptionBuilder.withLongOpt("logfile").withArgName("path").hasOptionalArg()
            .withDescription("Signal problems by writing to a log file.\n" + "Default filename is: "
                    + Args.DEFAULT_LOG_FILE_NAME + '.')
            .create(Arg.LOG_FILE.shortOpt()));
    options.addOption(Arg.DETAILED_LOG.shortOpt(), "detailed", false,
            "Log the full stack trace (combined with -Cc or -Cl)");
    options.addOption(OptionBuilder.withLongOpt("bypass").withArgName("prefixes").hasOptionalArg()
            .withDescription("Bypass classes starting with one of these prefixes (semi-colon separated list). "
                    + "\nExample: -Xb foo;bar.util\n will skip classes with name foo* or bar.util*")
            .create(Arg.BYPASS.shortOpt()));
    options.addOption(Arg.FILTER.shortOpt(), "filter", false, "Report each problem only once per faulty line");
    options.addOption(Arg.RUNTIME_STATS.shortOpt(), "summary", false, "Print runtime statistics");
    options.addOption(Arg.INSTRUMENTATION_STATS.shortOpt(), "stats", false, "Print instrumentation statistics");

    options.addOption(Arg.JMX_ENABLE.shortOpt(), false, "Enable JMX feature");
    options.addOption(OptionBuilder.withArgName("host").hasArg()
            .withDescription("Set remote JMX connection host (default: localhost)")
            .create(JMX_HOST.shortOpt()));
    options.addOption(OptionBuilder.withArgName("port").hasArg()
            .withDescription("Set remote JMX connection port (default: 5017)").create(JMX_PORT.shortOpt()));
    options.addOption(OptionBuilder.withArgName("MBean-id").hasArg()
            .withDescription("Set remote MBean name (default: COJAC)").create(JMX_NAME.shortOpt()));

    //        options.addOption(Arg.REPLACE_FLOATS.shortOpt(),
    //            "replacefloats", false, "Replace floats by Cojac-wrapper objects ");

    options.addOption(OptionBuilder.withArgName("class").hasArg()
            .withDescription("Select the double container (don't use it!).\n"
                    + "Example: -Wd cojac.BigDecimalDouble will use com.github.cojac.models.wrappers.BigDecimalDouble")
            .create(DOUBLE_WRAPPER.shortOpt()));
    options.addOption(OptionBuilder.withArgName("class").hasArg()
            .withDescription("Select the float container. See -Wd.").create(FLOAT_WRAPPER.shortOpt()));
    options.addOption(OptionBuilder.withArgName("class").hasArg()
            .withDescription("Select the wrapper (don't use it!).\n"
                    + "Example: -W cojac.WrapperBasic will use com.github.cojac.models.wrappers.WrapperBasic")
            .create(NG_WRAPPER.shortOpt()));

    options.addOption(OptionBuilder.withLongOpt("bigdecimal").withArgName("digits").hasArg()
            .withDescription("Use BigDecimal wrapping with a certain precision (number of digits).\n"
                    + "Example: -Rb 100 will wrap with 100-significant-digit BigDecimals")
            .create(BIG_DECIMAL_PRECISION.shortOpt()));

    options.addOption(Arg.INTERVAL.shortOpt(), "interval", false, "Use interval computation wrapping");
    options.addOption(Arg.STOCHASTIC.shortOpt(), "stochastic", false,
            "Use discrete stochastic arithmetic wrapping");
    options.addOption(Arg.AUTOMATIC_DERIVATION.shortOpt(), "autodiff", false,
            "Use automatic differentiation wrapping");

    options.addOption(Arg.DISABLE_UNSTABLE_COMPARISONS_CHECK.shortOpt(), false,
            "Disable unstability checks in comparisons, for the Interval or Stochastic wrappers");
    options.addOption(OptionBuilder.withArgName("epsilon").hasArg().withDescription(
            "Relative precision considered unstable, for Interval/Stochastic wrappers (default 0.00001)")
            .create(STABILITY_THRESHOLD.shortOpt()));

    options.addOption(Arg.ALL.shortOpt(), "all", false, "Sniff everywhere (this is the default behavior)");
    options.addOption(Arg.NONE.shortOpt(), "none", false, "Don't sniff at all");
    options.addOption(Arg.OPCODES.shortOpt(), true,
            "Sniff in those (comma separated) opcodes; eg: " + allOpcodes);
    options.addOption(Arg.MATHS.shortOpt(), false, "Sniff in (Strict)Math.xyz() methods");
    options.addOption(Arg.INTS.shortOpt(), false, "Sniff in ints opcodes");
    options.addOption(Arg.LONGS.shortOpt(), false, "Sniff in longs opcodes");
    options.addOption(Arg.CASTS.shortOpt(), false, "Sniff in casts opcodes");
    options.addOption(Arg.DOUBLES.shortOpt(), false, "Sniff in doubles opcodes");
    options.addOption(Arg.FLOATS.shortOpt(), false, "Sniff in floats opcodes");

    return options;
}

From source file:edu.umd.JBizz.BuildInvertedIndexCompressed.java

/**
 * Runs this tool./* w  w  w  . j ava 2s. c om*/
 */
@SuppressWarnings({ "static-access" })
public int run(String[] args) throws Exception {
    Options options = new Options();

    options.addOption(OptionBuilder.withArgName("path").hasArg().withDescription("input path").create(INPUT));
    options.addOption(OptionBuilder.withArgName("path").hasArg().withDescription("output path").create(OUTPUT));
    options.addOption(OptionBuilder.withArgName("num").hasArg().withDescription("number of reducers")
            .create(NUM_REDUCERS));

    CommandLine cmdline;
    CommandLineParser parser = new GnuParser();

    try {
        cmdline = parser.parse(options, args);
    } catch (ParseException exp) {
        System.err.println("Error parsing command line: " + exp.getMessage());
        return -1;
    }

    if (!cmdline.hasOption(INPUT) || !cmdline.hasOption(OUTPUT)) {
        System.out.println("args: " + Arrays.toString(args));
        HelpFormatter formatter = new HelpFormatter();
        formatter.setWidth(120);
        formatter.printHelp(this.getClass().getName(), options);
        ToolRunner.printGenericCommandUsage(System.out);
        return -1;
    }

    String inputPath = cmdline.getOptionValue(INPUT);
    String outputPath = cmdline.getOptionValue(OUTPUT);
    int reduceTasks = cmdline.hasOption(NUM_REDUCERS) ? Integer.parseInt(cmdline.getOptionValue(NUM_REDUCERS))
            : 1;

    LOG.info("Tool name: " + BuildInvertedIndexCompressed.class.getSimpleName());
    LOG.info(" - input path: " + inputPath);
    LOG.info(" - output path: " + outputPath);
    LOG.info(" - num reducers: " + reduceTasks);

    Job job = Job.getInstance(getConf());
    job.setJobName(BuildInvertedIndexCompressed.class.getSimpleName());
    job.setJarByClass(BuildInvertedIndexCompressed.class);

    job.setNumReduceTasks(reduceTasks);

    FileInputFormat.setInputPaths(job, new Path(inputPath));
    FileOutputFormat.setOutputPath(job, new Path(outputPath));

    //job.setMapOutputKeyClass(Text.class);
    //job.setMapOutputValueClass(PairOfInts.class);
    job.setMapOutputKeyClass(PairOfStringInt.class);
    job.setMapOutputValueClass(VIntWritable.class);
    job.setOutputKeyClass(Text.class);
    job.setOutputValueClass(BytesWritable.class);
    job.setOutputFormatClass(MapFileOutputFormat.class);

    job.setMapperClass(MyMapper.class);
    job.setReducerClass(MyReducer.class);
    job.setPartitionerClass(MyPartitioner.class);

    // Delete the output directory if it exists already.
    Path outputDir = new Path(outputPath);
    FileSystem.get(getConf()).delete(outputDir, true);

    long startTime = System.currentTimeMillis();
    job.waitForCompletion(true);
    System.out.println("Job Finished in " + (System.currentTimeMillis() - startTime) / 1000.0 + " seconds");

    return 0;
}

From source file:edu.psu.citeseerx.disambiguation.CsxDisambiguation.java

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

    options.addOption("help", false, "print help message");

    Option cmd = OptionBuilder.withArgName("cmd").hasArg().withDescription("init_dirs, init_blocks, dbscan")
            .create("cmd");
    Option infile = OptionBuilder.withArgName("file").hasArg().withDescription("a single input file")
            .create("infile");
    Option indir = OptionBuilder.withArgName("indir").hasArg()
            .withDescription("directory containing the input files").create("indir");
    Option outdir = OptionBuilder.withArgName("outdir").hasArg()
            .withDescription("directory to put the output files").create("outdir");
    options.addOption(cmd);//from   w w w .jav a 2 s  .co  m
    options.addOption(infile);
    options.addOption(indir);
    options.addOption(outdir);
    return options;
}

From source file:edu.umd.shrawanraina.ExtractTopPersonalizedPageRankNodes.java

/**
 * Runs this tool.//from  w  w  w  .j av a 2s . c o  m
 */
@SuppressWarnings({ "static-access" })
public int run(String[] args) throws Exception {
    Options options = new Options();

    options.addOption(OptionBuilder.withArgName("path").hasArg().withDescription("input path").create(INPUT));
    options.addOption(OptionBuilder.withArgName("path").hasArg().withDescription("output path").create(OUTPUT));
    options.addOption(OptionBuilder.withArgName("top").hasArg().withDescription("top num").create(TOP));
    options.addOption(
            OptionBuilder.withArgName("node").hasArg().withDescription("source node").create(SOURCES));

    CommandLine cmdline;
    CommandLineParser parser = new GnuParser();

    try {
        cmdline = parser.parse(options, args);
    } catch (ParseException exp) {
        System.err.println("Error parsing command line: " + exp.getMessage());
        return -1;
    }

    if (!cmdline.hasOption(INPUT) || !cmdline.hasOption(SOURCES) || !cmdline.hasOption(TOP)) {
        System.out.println("args: " + Arrays.toString(args));
        HelpFormatter formatter = new HelpFormatter();
        formatter.setWidth(120);
        formatter.printHelp(this.getClass().getName(), options);
        ToolRunner.printGenericCommandUsage(System.out);
        return -1;
    }

    String inputPath = cmdline.getOptionValue(INPUT);
    int n = Integer.parseInt(cmdline.getOptionValue(TOP));
    String source = cmdline.getOptionValue(SOURCES);
    String outputPath = cmdline.hasOption(OUTPUT) ? cmdline.getOptionValue(OUTPUT) : "final";

    LOG.info("Tool name: " + ExtractTopPersonalizedPageRankNodes.class.getSimpleName());
    LOG.info(" - input: " + inputPath);
    LOG.info(" - source: " + source);

    Configuration conf = new Configuration();
    conf.setInt("mapred.min.split.size", 1024 * 1024 * 1024);

    Job job = Job.getInstance(conf);
    job.setJobName(ExtractTopPersonalizedPageRankNodes.class.getSimpleName());
    job.setJarByClass(ExtractTopPersonalizedPageRankNodes.class);

    job.setNumReduceTasks(0);

    FileInputFormat.addInputPath(job, new Path(inputPath));
    FileOutputFormat.setOutputPath(job, new Path(outputPath));

    job.setInputFormatClass(SequenceFileInputFormat.class);
    job.setOutputFormatClass(TextOutputFormat.class);

    job.setMapOutputKeyClass(IntWritable.class);
    job.setMapOutputValueClass(PageRankNode.class);

    // Delete the output directory if it exists already.
    FileSystem.get(conf).delete(new Path(outputPath), true);

    job.waitForCompletion(true);
    extractTop(inputPath, outputPath, source, n);
    return 0;
}

From source file:de.vandermeer.skb.commons.utils.CLIApache.java

@Override
public Com_Coin declareOptions(PropertyTable prop) {
    String optShort;/*from   w ww .  j av a  2 s  . co m*/
    String optLong;
    CC_Warning ret = null;

    for (String current : prop.keys()) {
        if (prop.hasPropertyValue(current, EAttributeKeys.CLI_PARAMETER_TYPE)) {
            Object o = Skb_ObjectUtils.CONVERT(prop.get(current, EAttributeKeys.CLI_PARAMETER_LONG),
                    Object.class, NONull.get, NONone.get);
            if (!(o instanceof Com_Coin)) {
                optLong = o.toString();
            } else {
                optLong = null;
            }
            OptionBuilder.withLongOpt(optLong);

            o = Skb_ObjectUtils.CONVERT(prop.get(current, EAttributeKeys.CLI_PARAMETER_DESCRIPTION_SHORT),
                    Object.class, NONull.get, NONone.get);
            OptionBuilder.withDescription(o.toString());

            o = Skb_ObjectUtils.CONVERT(prop.get(current, EAttributeKeys.CLI_PARAMETER_DESCRIPTION_ARGUMENTS),
                    Object.class, NONull.get, NONone.get);
            if (!(o instanceof Com_Coin) && o.toString().length() > 0) {
                OptionBuilder.hasArg();
                OptionBuilder.withArgName(o.toString());
            } else {
                OptionBuilder.hasArg(false);
            }

            switch (this.typeMap
                    .getPair4Source(prop.get(current, EAttributeKeys.CLI_PARAMETER_TYPE).toString())) {
            case JAVA_BOOLEAN:
                OptionBuilder.withType(Boolean.class);
                break;
            case JAVA_DOUBLE:
                OptionBuilder.withType(Double.class);
                break;
            case JAVA_INTEGER:
                OptionBuilder.withType(Integer.class);
                break;
            case JAVA_LONG:
                OptionBuilder.withType(Long.class);
                break;
            case JAVA_STRING:
            default:
                OptionBuilder.withType(String.class);
                break;
            }

            o = prop.get(current, EAttributeKeys.CLI_PARAMETER_SHORT);
            if (o != null && !(o instanceof Com_Coin)) {
                optShort = o.toString();
            } else {
                optShort = null;
            }

            if (optShort != null && optLong != null) {
                this.options.addOption(OptionBuilder.create(optShort.charAt(0)));
                this.optionList.put(current, optLong);
            } else if (optLong != null) {
                this.options.addOption(OptionBuilder.create());
                this.optionList.put(current, optLong);
            } else {
                //dummy create, nothing to be done since no option set (short/long)
                OptionBuilder.withLongOpt("__dummyLongOpt__");
                OptionBuilder.create();

                if (ret == null) {
                    ret = new CC_Warning();
                }
                ret.add(new Message5WH_Builder().addWhat("no short and no long options for <").addWhat(current)
                        .addWhat(">").build());
            }
        }
    }

    if (ret == null) {
        return NOSuccess.get;
    }
    return ret;
}

From source file:com.google.api.ads.adwords.keywordoptimizer.KeywordOptimizer.java

/**
 * Creates the command line structure / options.
 *
 * @return the command line {@link Options}
 *//*from w w w  .  j av a  2 s .c  om*/
private static Options createCommandLineOptions() {
    Options options = new Options();

    OptionBuilder.withLongOpt("keyword-properties");
    OptionBuilder.withDescription("Location of the keyword-optimizer.properties file.");
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("file");
    options.addOption(OptionBuilder.create("kp"));

    OptionBuilder.withLongOpt("ads-properties");
    OptionBuilder.withDescription("Location of the ads.properties file.");
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("file");
    options.addOption(OptionBuilder.create("ap"));

    OptionBuilder.withLongOpt("help");
    OptionBuilder.withDescription("Shows this help screen.");
    OptionBuilder.withArgName("help");
    options.addOption(OptionBuilder.create("h"));

    OptionBuilder.withLongOpt("seed-keywords");
    OptionBuilder.withDescription("Use the given keywords (separated by spaces) as a seed for the optimization."
            + "\nNote: Only one seed-* option is allowed.");
    OptionBuilder.hasArg(true);
    OptionBuilder.hasArgs(Option.UNLIMITED_VALUES);
    OptionBuilder.withArgName("keywords");
    options.addOption(OptionBuilder.create("sk"));

    OptionBuilder.withLongOpt("seed-keywords-file");
    OptionBuilder.withDescription(
            "Use the keywords from the given file (one keyword per row) as a seed for the optimization."
                    + "\nNote: Only one seed-* option is allowed.");
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("file");
    options.addOption(OptionBuilder.create("skf"));

    OptionBuilder.withLongOpt("seed-terms");
    OptionBuilder
            .withDescription("Use the given search terms (separated by spaces) as a seed for the optimization."
                    + "\nNote: Only one seed-* option is allowed.");
    OptionBuilder.hasArg(true);
    OptionBuilder.hasArgs(Option.UNLIMITED_VALUES);
    OptionBuilder.withArgName("terms");
    options.addOption(OptionBuilder.create("st"));

    OptionBuilder.withLongOpt("seed-terms-file");
    OptionBuilder.withDescription("Use the search terms from the given file (one keyword per row) as a seed "
            + "for the optimization.\nNote: Only one seed-* option is allowed.");
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("file");
    options.addOption(OptionBuilder.create("stf"));

    OptionBuilder.withLongOpt("seed-urls");
    OptionBuilder.withDescription("Use the given urls (separated by spaces) to extract keywords as a seed for "
            + "the optimization.\nNote: Only one seed-* option is allowed.");
    OptionBuilder.hasArg(true);
    OptionBuilder.hasArgs(Option.UNLIMITED_VALUES);
    OptionBuilder.withArgName("urls");
    options.addOption(OptionBuilder.create("su"));

    OptionBuilder.withLongOpt("seed-urls-file");
    OptionBuilder
            .withDescription("Use the urls from the given file (one url per row) to extract keywords as a seed "
                    + "for the optimization.\nNote: Only one seed-* option is allowed.");
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("file");
    options.addOption(OptionBuilder.create("suf"));

    OptionBuilder.withLongOpt("seed-category");
    OptionBuilder.withDescription(
            "Use the given category (ID as defined @ https://goo.gl/xUEr6s) to get keywords as a seed "
                    + "for the optimization.\nNote: Only one seed-* option is allowed.");
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("id");
    options.addOption(OptionBuilder.create("sc"));

    OptionBuilder.withLongOpt("match-types");
    OptionBuilder.withDescription("Use the given keyword match types (EXACT, BROAD, PHRASE).");
    OptionBuilder.hasArg(true);
    OptionBuilder.hasArgs(3);
    OptionBuilder.withArgName("types");
    options.addOption(OptionBuilder.create("m"));

    OptionBuilder.withLongOpt("max-cpc");
    OptionBuilder.withDescription("Use the given maximum CPC (in USD, e.g., 5.0 for $5).");
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("double");
    options.addOption(OptionBuilder.create("cpc"));

    OptionBuilder.withLongOpt("locations");
    OptionBuilder.withDescription("Use the given locations IDs (ID as defined @ https://goo.gl/TA5E81) for "
            + "geo-targeted results.");
    OptionBuilder.hasArg(true);
    OptionBuilder.hasArgs(Option.UNLIMITED_VALUES);
    OptionBuilder.withArgName("ids");
    options.addOption(OptionBuilder.create("loc"));

    OptionBuilder.withLongOpt("languages");
    OptionBuilder.withDescription("Use the given locations IDs (ID as defined @ https://goo.gl/WWzifs) for "
            + "language-targeted results.");
    OptionBuilder.hasArg(true);
    OptionBuilder.hasArgs(Option.UNLIMITED_VALUES);
    OptionBuilder.withArgName("ids");
    options.addOption(OptionBuilder.create("lang"));

    OptionBuilder.withLongOpt("output");
    OptionBuilder.withDescription("Mode for outputting results (CONSOLE / CSV)\nNote: If set to CSV, then "
            + "option -of also has to be specified.");
    OptionBuilder.hasArg(true);
    OptionBuilder.hasArgs(2);
    OptionBuilder.withArgName("mode");
    options.addOption(OptionBuilder.create("o"));

    OptionBuilder.withLongOpt("output-file");
    OptionBuilder.withDescription("File to for writing output data (only needed if option -o is specified).");
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("file");
    options.addOption(OptionBuilder.create("of"));

    return options;
}