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:com.opengamma.integration.tool.marketdata.MarketDataSnapshotExportTool.java

private static Option createSnapshotNameOption() {
    final Option option = new Option(SNAPSHOT_NAME_OPTION, "snapshot-name", true,
            "The snapshot name to export");
    option.setArgName("snapshot name");
    return option;
}

From source file:com.opengamma.integration.tool.marketdata.MarketDataSnapshotExportTool.java

private static Option createSnapshotUidOption() {
    final Option option = new Option(SNAPSHOT_UID_OPTION, "snapshotUid", true,
            "The snapshot unique identifier to export");
    option.setArgName("snapshot uid");
    return option;
}

From source file:com.opengamma.integration.tool.marketdata.MarketDataSnapshotExportTool.java

private static Option createSnapshotDateOption() {
    final Option option = new Option(SNAPSHOT_DATE_OPTION, "snapshot-date", true,
            "Specify a version date for a named snapshot");
    option.setArgName("snapshot name");
    return option;
}

From source file:net.skyebook.zerocollada.ZeroCollada.java

public static void optionsSetup() {
    options = new Options();

    Option help = new Option(ZCOpts.help, "Print this help menu");
    Option transform = new Option(ZCOpts.transform,
            "Perform a transform.  Defaults to closet-to-origin anchor without consideration for the Y-axis");
    Option includeX = new Option(ZCOpts.includeX, "Include the X-Axis in this transform calculation");
    Option includeY = new Option(ZCOpts.includeY, "Include the Y-Axis in this transform calculation");
    Option includeZ = new Option(ZCOpts.includeZ, "Include the Z-Axis in this transform calculation");
    Option anchorCenter = new Option(ZCOpts.anchorCenter,
            "NOT IMPLEMENTED YET -- Anchors the transformation to the middle of the *range* of coordinates (not the average)");

    Option translate = new Option(ZCOpts.translate, true, "Change translations");
    translate.setArgName("translation type");
    translate.setArgs(2);//from   www  . j ava  2  s.  c o  m

    options.addOption(help);
    options.addOption(transform);
    options.addOption(includeX);
    options.addOption(includeY);
    options.addOption(includeZ);
    options.addOption(anchorCenter);
    options.addOption(translate);
}

From source file:com.opengamma.integration.tool.marketdata.MarketDataSnapshotExportTool.java

private static Option createFilenameOption() {
    final Option option = new Option(FILE_NAME_OPTION, "filename", true,
            "The path to the file to create and export to");
    //option.setRequired(true);
    option.setArgName("file path/name");
    return option;
}

From source file:de.topobyte.utilities.apache.commons.cli.OptionHelper.java

/**
 * Add a short option to the options specified by parameters
 * /* www. j a  va2 s.  co  m*/
 * @param options
 *            the options to add to.
 * @param opt
 *            the short option name.
 * @param hasArg
 *            whether it expects an argument
 * @param required
 *            whether this is a required option.
 * @param argName
 *            the name of the argument.
 * @param description
 *            the option description
 * @return the Option object created.
 */
public static Option addS(Options options, String opt, boolean hasArg, boolean required, String argName,
        String description) {
    Option option = new Option(opt, hasArg, description);
    option.setRequired(required);
    option.setArgName(argName);
    options.addOption(option);
    return option;
}

From source file:edu.wisc.my.portlets.dmp.tools.XmlMenuPublisherRunner.java

/**
 * Set up the command line options/*from w w  w. ja  v  a  2  s .  com*/
 */
private static Options setupOptions() {
    final Options opts = new Options();

    final Option xmlSource = new Option(XML_FILE_OPT, true,
            "The relative or absolute file system location of the menu XML document.");
    xmlSource.setRequired(true);
    xmlSource.setArgs(1);
    xmlSource.setArgName("path");
    xmlSource.setLongOpt("menuXmlFile");

    opts.addOption(xmlSource);

    return opts;
}

From source file:de.topobyte.utilities.apache.commons.cli.OptionHelper.java

/**
 * Add an option to the options specified by parameters
 * // w  w w.j av a 2s .c o m
 * @param options
 *            the options to add to.
 * @param opt
 *            the short option name.
 * @param longName
 *            the long option name.
 * @param hasArg
 *            whether it expects an argument
 * @param required
 *            whether this is a required option.
 * @param argName
 *            the name of the argument.
 * @param description
 *            the option description
 * @return the Option object created.
 */
public static Option add(Options options, String opt, String longName, boolean hasArg, boolean required,
        String argName, String description) {
    Option option = new Option(opt, longName, hasArg, description);
    option.setRequired(required);
    option.setArgName(argName);
    options.addOption(option);
    return option;
}

From source file:de.topobyte.utilities.apache.commons.cli.OptionHelper.java

/**
 * Add a long option to the options specified by parameters
 * //from   w w  w  .j a  v  a2 s .  co  m
 * @param options
 *            the options to add to.
 * @param longName
 *            the long option name.
 * @param hasArg
 *            whether it expects an argument
 * @param required
 *            whether this is a required option.
 * @param argName
 *            the name of the argument.
 * @param description
 *            the option description
 * @return the Option object created.
 */
public static Option addL(Options options, String longName, boolean hasArg, boolean required, String argName,
        String description) {
    Option option = new Option(null, longName, hasArg, description);
    option.setRequired(required);
    option.setArgName(argName);
    options.addOption(option);
    return option;
}

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

/**
 * Parse command-line arguments./*from  w w w. jav a2 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("m", "maxCount", true, "maximum number of records to be returned");
    o.setArgName("maxCount");
    o.setRequired(false);
    options.addOption(o);

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

    o = new Option("p", "processFileSubstring", true,
            "use only those process records where the process file path contains the provided string.");
    o.setArgName("processFileSubstring");
    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(ProcessingRecordsPrinter.class);
        log.setLevel(Level.DEBUG);
    }

    return commandLine;
}