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

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

Introduction

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

Prototype

public static OptionBuilder withLongOpt(String newLongopt) 

Source Link

Document

The next Option created will have the following long option value.

Usage

From source file:com.splunk.Command.java

@SuppressWarnings("static-access") // OptionBuilder API requires this
public Command init() {
    rules.addOption("h", "help", false, "Display this help message");
    rules.addOption(null, "host", true, "Host name (default localhost)");
    rules.addOption(OptionBuilder.withLongOpt("port").hasArg(true).withType(Integer.class).create());
    rules.addOption(null, "scheme", true, "Scheme (default https)");
    rules.addOption(null, "username", true, "Username to login with");
    rules.addOption(null, "password", true, "Password to login with");
    rules.addOption(null, "app", true, "App/namespace context");
    rules.addOption(null, "owner", true, "Owner/user context");
    // This is here only for compatibility with the JavaScript SDK's .splunkrc.
    rules.addOption(null, "version", true, "Version (irrelevant for Java)");
    return this;
}

From source file:com.eucalyptus.simpleworkflow.common.client.WorkflowClientStandalone.java

@SuppressWarnings("static-access")
private static Options buildOptions() {
    final Options opts = new Options();
    opts.addOption(OptionBuilder.withLongOpt("endpoint").hasArgs(1).withDescription("SWF Service Endpoint")
            .isRequired().create('e'));

    opts.addOption(OptionBuilder.withLongOpt("domain").hasArgs(1).withDescription("SWF Domain").isRequired()
            .create('d'));

    opts.addOption(OptionBuilder.withLongOpt("tasklist").hasArgs(1).withDescription("SWF task list")
            .isRequired().create('l'));

    opts.addOption(OptionBuilder.withLongOpt("timeout").hasArgs(1)
            .withDescription("SWF client connection timeout").isRequired(false).create('o'));

    opts.addOption(OptionBuilder.withLongOpt("maxconn").hasArgs(1).withDescription("SWF client max connections")
            .isRequired(false).create('m'));

    opts.addOption(OptionBuilder.withLongOpt("retention").hasArgs(1)
            .withDescription("SWF domain retention period in days").isRequired(false).create('r'));

    opts.addOption(OptionBuilder.withLongOpt("threads").hasArgs(1).withDescription("Polling threads count")
            .isRequired(false).create('t'));

    opts.addOption(OptionBuilder.withLongOpt("jar").hasArgs(1)
            .withDescription("JAR file that implement workflows" + " and activities").isRequired(true)
            .create());/*from  www  .  j  a  v  a  2 s .  com*/

    opts.addOption(OptionBuilder.withLongOpt("classes").hasArgs(1)
            .withDescription("Limit workflow and activities classes to load (class names are separated by ':')")
            .isRequired(false).create());

    opts.addOption(OptionBuilder.withLongOpt("credential").hasArgs(1).withDescription(
            "Property file containing AWS credentials to use (default is to use session credentials from instance's metadata")
            .isRequired(false).create());

    opts.addOption(OptionBuilder.withLongOpt("loglevel").hasArgs(1)
            .withDescription("Logging level (default: DEBUG)").isRequired(false).create());

    opts.addOption(OptionBuilder.withLongOpt("logdir").hasArgs(1)
            .withDescription("Directory containing log files (default: /var/log/eucalyptus)").isRequired(false)
            .create());

    opts.addOption(OptionBuilder.withLongOpt("logappender").hasArgs(1).withDescription("Log4j appender to use")
            .isRequired(false).create());

    return opts;
}

From source file:edu.freiburg.dbis.rdd.RddExtractor.java

private static Options createOptions() {
    Options options = new Options();
    options.addOption(OptionBuilder.withLongOpt("input-file")
            .withDescription("Input file that contains the RDF graph").hasArg().create("i"));
    options.addOption(OptionBuilder.withLongOpt("output-file")
            .withDescription("Output filename where the RDD should be written").isRequired().hasArg()
            .create("o"));
    options.addOption(OptionBuilder.withLongOpt("sparql-enpoint")
            .withDescription("URL of the sparql enpoint that should be queried").hasArg().create("e"));
    options.addOption(OptionBuilder.withLongOpt("graph-name")
            .withDescription("Name of the Graph that should be queried (only works for virtuoso endpoints)")
            .hasArg().create("g"));
    options.addOption(/*from w  w  w  . j  a va2 s .c om*/
            OptionBuilder.withLongOpt("WA").withDescription("Modeling a subset (OWA) or the full dataset (CWA)")
                    .isRequired().hasArg().create("w"));
    options.addOption(OptionBuilder.withLongOpt("log4j-properties")
            .withDescription("log4j.properties file location if not using the default configuration.").hasArg()
            .create("l"));
    options.addOption(OptionBuilder.withLongOpt("help").withDescription("show this help").hasArg().create("h"));
    options.addOption(OptionBuilder.withLongOpt("verbose").withDescription("use verbose mode").create("v"));
    return options;
}

From source file:net.nicholaswilliams.java.licensing.licensor.interfaces.cli.spi.CliOptionsBuilder.java

public CliOptionsBuilder withLongOpt(String newLongopt) {
    OptionBuilder.withLongOpt(newLongopt);
    return this;
}

From source file:io.github.agentsoz.abmjadex.super_central.ABMSimStarter.java

@SuppressWarnings({ "static-access" })
private static Options commandLinePreparation() {
    Options options = new Options();

    // create the Options      
    options.addOption(HELP, "help", false, "print the help list on usage (this message.)");
    options.addOption(FORCED, "force", false, "overwrite any CentralOrganizer created before.");
    options.addOption(LOG_CONSOLE, false, "Deciding whether to show logging to console or not");

    options.addOption(OptionBuilder.withDescription("Launch JCC or not (by default : not)").hasArg()
            .withArgName("run_jcc").create(GUI));
    options.addOption(//  www  . j ava 2s .  c  o m
            OptionBuilder.withLongOpt("properties").withDescription("Locate the app's properties file").hasArg()
                    .withArgName("properties_file").create(PROP));
    options.addOption(OptionBuilder
            .withDescription("Choose the starting mode." + "sc_only, will run only the SuperCentral,"
                    + "sc_co, will run both sc and co specified in properties file"
                    + "co_only, will run only a central organizer")
            .hasArg().withArgName("start_mode").create(MODE));
    options.addOption(OptionBuilder
            .withDescription("Setup the logging level."
                    + "{SEVERE,WARNING,INFO,CONFIG,FINE,FINER,FINEST}(default: INFO)")
            .hasArg().withArgName("log_level").create(LOG_LVL));
    return options;
}

From source file:net.sourceforge.docfetcher.CommandLineHandler.java

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

    // Windows registry manipulation options
    OptionGroup registryGroup = new OptionGroup();
    registryGroup.addOption(OptionBuilder.withLongOpt(REGISTER_CONTEXTMENU)
            .withDescription("add search entry to Windows explorer contextmenu").create());
    registryGroup.addOption(OptionBuilder.withLongOpt(UNREGISTER_CONTEXTMENU)
            .withDescription("remove search entry from Windows explorer contextmenu").create());
    options.addOptionGroup(registryGroup);

    // Text extraction options
    OptionGroup extractGroup = new OptionGroup();
    extractGroup.addOption(OptionBuilder.withLongOpt(EXTRACT)
            .withDescription("extract text from documents to textfile").hasOptionalArgs().create());
    extractGroup.addOption(OptionBuilder.withLongOpt(EXTRACT_DIR)
            .withDescription("extract text from documents to directory").hasOptionalArgs().create());
    options.addOptionGroup(extractGroup);

    // Inclusion and exclusion filter options
    options.addOption(/*from  w  ww  . jav  a2s .co  m*/
            OptionBuilder.withLongOpt(INCLUDE).withDescription("regex inclusion filter for text extraction")
                    .hasArg().withArgName(REGEX).create());
    options.addOption(
            OptionBuilder.withLongOpt(EXCLUDE).withDescription("regex exclusion filter for text extraction")
                    .hasArg().withArgName(REGEX).create());

    // Version info and help options
    options.addOption("h", "help", false, "print this help and exit");
    options.addOption("v", "version", false, "print version number and exit");

    return options;
}

From source file:ca.uqac.info.tag.Counter.TagCounter.java

/**
* Sets up the options for the command line parser
* @return The options/* ww  w.  j  ava2 s .c  o m*/
*/
@SuppressWarnings("static-access")
private static Options setupOptions() {
    Options options = new Options();
    Option opt;
    opt = OptionBuilder.withLongOpt("help").withDescription("Display command line usage").create("h");
    options.addOption(opt);
    opt = OptionBuilder.withLongOpt("Tag").withArgName("x").hasArg().withDescription("The tag will be counted")
            .create("t");
    options.addOption(opt);
    opt = OptionBuilder.withLongOpt("InputFile").withArgName("x").hasArg()
            .withDescription("Set the iput file to analyse").create("i");
    options.addOption(opt);
    opt = OptionBuilder.withLongOpt("redirection").withArgName("x").hasArg()
            .withDescription("Set the redirection file for the System.out").create("r");
    options.addOption(opt);
    return options;
}

From source file:iDynoOptimizer.MOEAFramework26.src.org.moeaframework.analysis.sensitivity.Evaluator.java

@SuppressWarnings("static-access")
@Override/*from  w w w  . j  a  va 2  s.  c  om*/
public Options getOptions() {
    Options options = super.getOptions();

    options.addOption(
            OptionBuilder.withLongOpt("parameterFile").hasArg().withArgName("file").isRequired().create('p'));
    options.addOption(OptionBuilder.withLongOpt("input").hasArg().withArgName("file").isRequired().create('i'));
    options.addOption(
            OptionBuilder.withLongOpt("output").hasArg().withArgName("file").isRequired().create('o'));
    options.addOption(
            OptionBuilder.withLongOpt("problem").hasArg().withArgName("name").isRequired().create('b'));
    options.addOption(
            OptionBuilder.withLongOpt("algorithm").hasArg().withArgName("name").isRequired().create('a'));
    options.addOption(OptionBuilder.withLongOpt("properties").hasArgs().withArgName("p1=v1;p2=v2;...")
            .withValueSeparator(';').create('x'));
    options.addOption(OptionBuilder.withLongOpt("seed").hasArg().withArgName("value").create('s'));
    options.addOption(OptionBuilder.withLongOpt("epsilon").hasArg().withArgName("e1,e2,...").create('e'));
    options.addOption(OptionBuilder.withLongOpt("metrics").create('m'));
    options.addOption(OptionBuilder.withLongOpt("reference").hasArg().withArgName("file").create('r'));
    options.addOption(OptionBuilder.withLongOpt("novariables").create('n'));
    options.addOption(OptionBuilder.withLongOpt("force").create('f'));

    return options;
}

From source file:bdsup2sub.cli.CommandLineOptions.java

private void createAndAddOptions() {
    Option help = OptionBuilder.withLongOpt("help").withDescription("Show usage information and exit.")
            .hasArg(false).create(HELP);
    options.addOption(help);/*from ww  w .j  av  a  2 s.co  m*/

    Option version = OptionBuilder.withLongOpt("version").withDescription("Show version information and exit.")
            .hasArg(false).create(VERSION);
    options.addOption(version);

    Option output = OptionBuilder.withLongOpt("output").withDescription("Specify output file.").hasArg()
            .create(OUTPUT_FILE);
    options.addOption(output);

    Option verbose = OptionBuilder.withLongOpt("verbose").withDescription("Verbose console output mode.")
            .hasArg(false).create(VERBOSE);
    options.addOption(verbose);

    Option loadSettings = OptionBuilder.withLongOpt("load-settings")
            .withDescription("Load settings stored in configuration file even if running in command-line mode.")
            .hasArg(false).create(LOAD_SETTINGS);
    options.addOption(loadSettings);

    Option resolution = OptionBuilder.withArgName("resolution").withLongOpt("resolution").withDescription(
            "Set resolution to: keep, ntsc=480, pal=576, 720p=720, 1080p=1080, 1440x1080\nDefault: keep")
            .hasArg().create(RESOLUTION);
    options.addOption(resolution);

    OptionGroup framerateGroup = new OptionGroup();
    Option targetFrameRate = OptionBuilder.withArgName("fps").withLongOpt("fps-target").withDescription(
            "Synchronize target frame rate to <fps>.\nPredefined values: 24p=23.976, pal or 25p=25, ntsc or 30p=29.967, keep (preserves the source fps for BD&XML, else default)\nDefault: automatic (dumb!).")
            .hasArg().create(TARGET_FRAMERATE);
    framerateGroup.addOption(targetFrameRate);

    Option convertFrameRate = OptionBuilder.withArgName("src>, <trg").withLongOpt("convert-fps")
            .withDescription(
                    "Convert frame rate from <src> to <trg>\nSupported values: 24p=23.976, 25p=25, 30p=29.970\nauto,<trg> detects source frame rate.")
            .withValueSeparator(',').hasArgs(2).create(CONVERT_FRAMERATE);
    framerateGroup.addOption(convertFrameRate);

    options.addOptionGroup(framerateGroup);

    Option delay = OptionBuilder.withArgName("delay").withLongOpt("delay")
            .withDescription("Set delay in ms\nDefault: 0.0").hasArg().create(DELAY);
    options.addOption(delay);

    Option filter = OptionBuilder.withArgName("filter").withLongOpt("filter").withDescription(
            "Set the filter to use for scaling.\nSupported values: bilinear, triangle, bicubic, bell, b-spline, hermite, lanczos3, mitchell\nDefault: bilinear")
            .hasArg().create(SCALING_FILTER);
    options.addOption(filter);

    Option paletteMode = OptionBuilder.withArgName("mode").withLongOpt("palette-mode")
            .withDescription("Set palette mode.\nSupported values: keep, create, dither\nDefault: create")
            .hasArg().create(PALETTE_MODE);
    options.addOption(paletteMode);

    Option minDisplayTime = OptionBuilder.withArgName("time").withLongOpt("minimum-time")
            .withDescription("Set minimum display time in ms.\nDefault: 500").hasArg().create(MIN_DISPLAY_TIME);
    options.addOption(minDisplayTime);

    Option maxTimeDiff = OptionBuilder.withArgName("time").withLongOpt("merge-time")
            .withDescription("Set maximum time difference for merging subtitles in ms.\nDefault: 200").hasArg()
            .create(MAX_TIME_DIFF);
    options.addOption(maxTimeDiff);

    OptionGroup moveGroup = new OptionGroup();
    Option moveIn = OptionBuilder.withArgName("ratio, offset").withLongOpt("move-in")
            .withDescription("Move captions inside screen ratio <ratio>, +/- offset <offset>")
            .withValueSeparator(',').hasArgs(2).create(MOVE_IN);
    moveGroup.addOption(moveIn);

    Option moveOut = OptionBuilder.withArgName("ratio, offset").withLongOpt("move-out")
            .withDescription("Move captions outside screen ratio <ratio>, +/- offset <offset>")
            .withValueSeparator(',').hasArgs(2).create(MOVE_OUT);
    moveGroup.addOption(moveOut);

    options.addOptionGroup(moveGroup);

    Option moveX = OptionBuilder.withArgName("pos[, offset]").withLongOpt("move-x").withDescription(
            "Move captions horizontally from specified position. <pos> may be left, right, center\n+/- optional offset <offset> (only if moving left or right)")
            .withValueSeparator(',').hasOptionalArgs(2).create(MOVE_X);
    options.addOption(moveX);

    Option cropLines = OptionBuilder.withArgName("n").withLongOpt("crop-y")
            .withDescription("Crop the upper/lower n lines.\nDefault: 0").hasArg().create(CROP_LINES);
    options.addOption(cropLines);

    Option alphaCropThreshold = OptionBuilder.withArgName("n").withLongOpt("alpha-crop")
            .withDescription("Set the alpha cropping threshold.\nDefault: 10").hasArg()
            .create(ALPHA_CROP_THRESHOLD);
    options.addOption(alphaCropThreshold);

    Option scale = OptionBuilder.withArgName("x, y").withLongOpt("scale")
            .withDescription("Scale captions horizontally and vertically.\nDefault: 1.0,1.0")
            .withValueSeparator(',').hasArgs(2).create(SCALE);
    options.addOption(scale);

    Option exportPalette = OptionBuilder.withLongOpt("export-palette")
            .withDescription("Export target palette in PGCEdit format.").hasArg(false).create(EXPORT_PALETTE);
    options.addOption(exportPalette);

    Option exportForcedSubtitlesOnly = OptionBuilder.withLongOpt("forced-only")
            .withDescription("Export only forced subtitles (when converting from BD-SUP).").hasArg(false)
            .create(EXPORT_FORCED_SUBTITLES_ONLY);
    options.addOption(exportForcedSubtitlesOnly);

    Option setForcedFlag = OptionBuilder.withArgName("state").withLongOpt("force-all")
            .withDescription("Set or clear the forced flag for all subtitles.\nSupported values: set, clear")
            .hasArg().create(FORCED_FLAG);
    options.addOption(setForcedFlag);

    Option swapCrCb = OptionBuilder.withLongOpt("swap")
            .withDescription("Swap Cr/Cb components when loading a BD/HD-DVD sup file.").hasArg(false)
            .create(SWAP_CR_CB);
    options.addOption(swapCrCb);

    Option fixInvisibleFrames = OptionBuilder.withLongOpt("fix-invisible")
            .withDescription("Fix zero alpha frame palette for SUB/IDX and SUP/IFO.").hasArg(false)
            .create(FIX_INVISIBLE_FRAMES);
    options.addOption(fixInvisibleFrames);

    Option alphaThreshold = OptionBuilder.withArgName("n").withLongOpt("alpha-thr")
            .withDescription("Set alpha threshold 0..255 for SUB/IDX conversion.\nDefault: 80").hasArg()
            .create(ALPHA_THRESHOLD);
    options.addOption(alphaThreshold);

    Option luminanceLowMedThreshold = OptionBuilder.withArgName("n").withLongOpt("lum-low-med-thr")
            .withDescription("Set luminance lo/med threshold 0..255 for SUB/IDX conversion.\nDefault: auto")
            .hasArg().create(LUM_LOW_MED_THRESHOLD);
    options.addOption(luminanceLowMedThreshold);

    Option luminanceMedHighThreshold = OptionBuilder.withArgName("n").withLongOpt("lum-med-hi-thr")
            .withDescription("Set luminance med/hi threshold 0..255 for SUB/IDX conversion.\nDefault: auto")
            .hasArg().create(LUM_MED_HIGH_THRESHOLD);
    options.addOption(luminanceMedHighThreshold);

    Option languageCode = OptionBuilder.withArgName("language").withLongOpt("language")
            .withDescription("Set language for SUB/IDX export.\nDefault: en").hasArg().create(LANGUAGE_CODE);
    options.addOption(languageCode);

    Option paletteFile = OptionBuilder.withArgName("file").withLongOpt("palette-file")
            .withDescription("Load palette file for SUB/IDX conversion. Overrides default palette.").hasArg()
            .create(PALETTE_FILE);
    options.addOption(paletteFile);
}

From source file:com.clothcat.sysutils.files.Basename.java

private static void parseOptions(String[] args) {
    try {//from   w  ww.j a v a  2 s.com
        options = new Options();
        options.addOption("help", false, "display help output and exit");
        options.addOption("version", false, "output version information and exit");
        options.addOption("a", "multiple", false, "support multiple arguments and treat each as a NAME");
        options.addOption(OptionBuilder.withLongOpt("suffix").withDescription("remove a trailing SUFFIX")
                .hasArg().withArgName("SUFFIX").create('s'));
        options.addOption("z", "zero", false, "seperate output with NUL rather than newline");

        CommandLineParser parser = new GnuParser();
        commandLine = parser.parse(options, args);
    } catch (ParseException ex) {
        Logger.getLogger(Basename.class.getName()).log(Level.SEVERE, null, ex);
    }
}