List of usage examples for org.apache.commons.cli OptionBuilder withLongOpt
public static OptionBuilder withLongOpt(String newLongopt)
From source file:cognition.pipeline.commandline.CommandExportToElasticsearch.java
@Override public void addOption(Options options) { options.addOption(OptionBuilder.withLongOpt("exportToElastic") .withDescription("Exports Cognition text to a specified Elasticsearch cluster").hasArg() .withArgName("exportToElastic").create()); }
From source file:iDynoOptimizer.MOEAFramework26.src.org.moeaframework.analysis.sensitivity.SimpleStatistics.java
@SuppressWarnings("static-access") @Override/*from www . j a va2 s . c o m*/ public Options getOptions() { Options options = super.getOptions(); options.addOption(OptionBuilder.withLongOpt("mode").hasArg().create('m')); options.addOption(OptionBuilder.withLongOpt("output").hasArg().withArgName("file").create('o')); options.addOption(OptionBuilder.withLongOpt("ignore").create('i')); options.addOption(OptionBuilder.withLongOpt("maximum").hasArg().withArgName("value").create('x')); return options; }
From source file:net.orpiske.ssps.sdm.actions.Update.java
@Override protected void processCommand(String[] args) { CommandLineParser parser = new PosixParser(); options = new Options(); options.addOption("h", "help", false, "prints the help"); options.addOption(null, "rebuild-cache-only", false, "only rebuilds the cache without updating from the remote repository"); Option reposOptions = OptionBuilder.withLongOpt("repositories").create(); reposOptions.setArgs(255);//from ww w . j a v a 2 s . c o m reposOptions.setRequired(false); reposOptions.setDescription("the repository(ies) to update"); options.addOption(reposOptions); try { cmdLine = parser.parse(options, args); } catch (ParseException e) { help(options, -1); } isHelp = cmdLine.hasOption("help"); rebuildCacheOnly = cmdLine.hasOption("rebuild-cache-only"); repositories = cmdLine.getOptionValues("repositories"); }
From source file:com.linkedin.helix.controller.HelixControllerMain.java
@SuppressWarnings("static-access") synchronized private static Options constructCommandLineOptions() { Option helpOption = OptionBuilder.withLongOpt(help).withDescription("Prints command-line options info") .create();//from ww w. j a va 2 s. c o m Option zkServerOption = OptionBuilder.withLongOpt(zkServerAddress) .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 modeOption = OptionBuilder.withLongOpt(mode) .withDescription("Provide cluster controller mode (Optional): STANDALONE (default) or DISTRIBUTED") .create(); modeOption.setArgs(1); modeOption.setRequired(false); modeOption.setArgName("Cluster controller mode (Optional)"); Option controllerNameOption = OptionBuilder.withLongOpt(name) .withDescription("Provide cluster controller name (Optional)").create(); controllerNameOption.setArgs(1); controllerNameOption.setRequired(false); controllerNameOption.setArgName("Cluster controller name (Optional)"); Option portOption = OptionBuilder.withLongOpt(propertyTransferServicePort) .withDescription("Webservice port for ZkProperty controller transfer").create(); portOption.setArgs(1); portOption.setRequired(false); portOption.setArgName("Cluster controller property transfer port (Optional)"); Options options = new Options(); options.addOption(helpOption); options.addOption(zkServerOption); options.addOption(clusterOption); options.addOption(modeOption); options.addOption(portOption); options.addOption(controllerNameOption); return options; }
From source file:be.dnsbelgium.rdap.client.RDAPOptions.java
public RDAPOptions(Locale locale) { super();/* w w w. j a va2 s .c om*/ addOption(null, "version", false, "display version, authors and licensing information."); addOption("h", "help", false, "display a short help text."); addOption(OptionBuilder.withLongOpt("config") .withDescription("uses FILE as a configuration file instead of the default.").hasArg() .withArgName("FILE").create("c")); addOption(OptionBuilder.withLongOpt(URL) .withDescription("overrides any hosts in the configuration file and queries HOST directly.") .hasArg().withArgName("URL").create("u")); addOption(OptionBuilder.withLongOpt(USERNAME) .withDescription("Specify a username to be used with Basic Authentication.").hasArg() .withArgName("USERNAME").create()); addOption(OptionBuilder.withLongOpt(KEYSTORE) .withDescription("Tells rdap to use the specified keystore file when getting info with RDAP") .hasArg().withArgName("FILE").create()); addOption(OptionBuilder .withLongOpt(KEYSTORE_TYPE).withDescription(String .format("Type of the keystore. Either JKS or PKCS12, default is %s", DEFAULT_STORETYPE)) .hasArg().withArgName("TYPE").create()); addOption(OptionBuilder.withLongOpt(KEYSTORE_PASS).withDescription(String.format( "Tells rdap to use the specified keystore file when getting info with RDAP. Default value is changeit", DEFAULT_PASS)).hasArg().withArgName("PASSWORD").create()); addOption(OptionBuilder.withLongOpt(KEYPASS).withDescription(String.format( "Tells rdap to use the specified key password when getting info with RDAP. Default value is %s", DEFAULT_PASS)).hasArg().withArgName("PASSWORD").create()); addOption(OptionBuilder.withLongOpt(TRUSTSTORE).withDescription( "Tells rdap to use the specified certificate file to verify the peer. The file may contain multiple CA certificates. The certificate(s) must be\n" + " in PEM format.") .hasArg().withArgName("FILE").create()); addOption(OptionBuilder.withLongOpt(TRUSTSTORE_TYPE) .withDescription("Type of the truststore. Either JKS or PKCS12").hasArg().withArgName("TYPE") .create()); addOption(OptionBuilder.withLongOpt(TRUSTSTORE_PASS).withDescription(String.format( "Tells rdap to use the specified keystore file when getting info with RDAP. Default value is %s", DEFAULT_PASS)).hasArg().withArgName("PASSWORD").create()); addOption(OptionBuilder.withLongOpt(INSECURE) .withDescription("This option explicitly allows RDAP to perform \"insecure\" SSL connections") .create("i")); addOption(OptionBuilder.withLongOpt(RAW) .withDescription("Causes rdap to emit raw (not pretty-printed) JSON rather than text output.") .create()); addOption(OptionBuilder.withLongOpt(PRETTY) .withDescription("Causes rdap to emit pretty-printed JSON rather than text output.").create()); addOption(OptionBuilder.withLongOpt(YAML) .withDescription("Causes rdap to emit pretty-printed YAML rather than text output.").create()); addOption(OptionBuilder.withLongOpt(PASSWORD) .withDescription("Specify a password to be used with Basic Authentication.").hasArg() .withArgName("PASSWORD").create()); addOption(OptionBuilder.withLongOpt(LANG).withDescription( "Specify a language. This is sent to the server using the Accept-Language header. If unset, the language will be taken from your $LANG environment variable (or en if that is not defined).") .hasArg().withArgName("LANG").create()); }
From source file:de.tudarmstadt.lt.lm.app.FilterLines.java
@SuppressWarnings("static-access") public FilterLines(String args[]) { Options opts = new Options(); opts.addOption(new Option("?", "help", false, "display this message")); opts.addOption(OptionBuilder.withLongOpt("file").withArgName("name").hasArg().withDescription( "Specify the file or directory that contains '.txt' files that are used as source for testing perplexity with the specified language model. Specify '-' to pipe from stdin. (default: '-').") .create("f")); opts.addOption(OptionBuilder.withLongOpt("out").withArgName("name").hasArg() .withDescription("Specify the output file. Specify '-' to use stdout. (default: '-').") .create("o")); opts.addOption(OptionBuilder.withLongOpt("runparallel") .withDescription("Specify if processing should happen in parallel.").create("p")); opts.addOption(OptionBuilder.withLongOpt("maximum-perplexity").withArgName("perplexity-value").hasArg() .withDescription(//from w w w.j a v a 2s. com "Specify the maximum perplexity value (with oov / 5th col) allowed, everything greater this value will not be printed. (default: '1000').") .create("m")); try { CommandLine cmd = new ExtendedGnuParser(true).parse(opts, args); if (cmd.hasOption("help")) CliUtils.print_usage_quit(System.err, StartLM.class.getSimpleName(), opts, USAGE_HEADER, null, 0); _file = cmd.getOptionValue("file", "-"); _out = cmd.getOptionValue("out", "-"); _parallel = cmd.hasOption("runparallel"); _max_perp = Double.parseDouble(cmd.getOptionValue("maximum-perplexity", "1000")); } catch (Exception e) { LOG.error("{}: {}", e.getClass().getSimpleName(), e.getMessage()); CliUtils.print_usage_quit(System.err, getClass().getSimpleName(), opts, USAGE_HEADER, String.format("%s: %s%n", e.getClass().getSimpleName(), e.getMessage()), 1); } }
From source file:com.marklogic.shell.command.load.java
public load() { Option uriPrefixOption = OptionBuilder.withLongOpt("uriprefix") .withDescription("uri prefix to append to file names when loading").hasArg().create("i"); Option uriOption = OptionBuilder.withLongOpt("uri").withDescription("uri of the document being loaded") .hasArg().create("n"); Option colOption = OptionBuilder.withLongOpt("collection") .withDescription("add document(s) to collection when loading").hasArg().create("c"); Option qualityOption = OptionBuilder.withLongOpt("quality") .withDescription("add quality to document(s) when loading").hasArg().create("q"); Option permOption = OptionBuilder.withLongOpt("permission") .withDescription("add permissions to document(s) when loading in the form of 'capability:role'. " + "Capability must be one of: execute,insert,read,update") .hasArg().create("x"); Option typeOption = OptionBuilder.withLongOpt("type") .withDescription(// w w w . j av a 2 s . c o m "add document format to document(s) when loading. Must be one of " + "binary,text,xml") .hasArg().create("t"); options.addOption(uriPrefixOption); options.addOption(uriOption); options.addOption(colOption); options.addOption(permOption); options.addOption(typeOption); options.addOption(qualityOption); }
From source file:iDynoOptimizer.MOEAFramework26.src.org.moeaframework.analysis.sensitivity.SetContribution.java
@SuppressWarnings("static-access") @Override/*from w w w . j a v a 2s . c o m*/ public Options getOptions() { Options options = super.getOptions(); options.addOption( OptionBuilder.withLongOpt("reference").hasArg().withArgName("file").isRequired().create('r')); options.addOption(OptionBuilder.withLongOpt("epsilon").hasArg().withArgName("e1,e2,...").create('e')); return options; }
From source file:luceneGazateer.EntryData.java
public static void main(String[] args) throws IOException { Option buildOpt = OptionBuilder.withArgName("gazetteer file").hasArg().withLongOpt("build") .withDescription("The Path to the Geonames allCountries.txt").create('b'); Option searchOpt = OptionBuilder.withArgName("set of location names").withLongOpt("search").hasArgs() .withDescription("Location names to search the Gazetteer for").create('s'); Option indexOpt = OptionBuilder.withArgName("directoryPath").withLongOpt("index").hasArgs() .withDescription("The path to the Lucene index directory to either create or read").create('i'); Option helpOpt = OptionBuilder.withLongOpt("help").withDescription("Print this message.").create('h'); String indexPath = null;// w ww . ja v a 2 s .c o m String gazetteerPath = null; ArrayList<String> geoTerms = null; Options options = new Options(); options.addOption(buildOpt); options.addOption(searchOpt); options.addOption(indexOpt); options.addOption(helpOpt); // create the parser CommandLineParser parser = new DefaultParser(); GeoNameResolver resolver = new GeoNameResolver(); try { // parse the command line arguments CommandLine line = parser.parse(options, args); if (line.hasOption("index")) { indexPath = line.getOptionValue("index"); } if (line.hasOption("build")) { gazetteerPath = line.getOptionValue("build"); } if (line.hasOption("help")) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("lucene-geo-gazetteer", options); System.exit(1); } if (indexPath != null && gazetteerPath != null) { LOG.info("Building Lucene index at path: [" + indexPath + "] with geoNames.org file: [" + gazetteerPath + "]"); resolver.buildIndex(gazetteerPath, indexPath); } if (line.hasOption("search")) { String temp_s = ""; for (String string : line.getOptionValues("search")) { temp_s += string; } produceCandidates(indexPath, temp_s, resolver); } } catch (ParseException exp) { // oops, something went wrong System.err.println("Parsing failed. Reason: " + exp.getMessage()); } }
From source file:iDynoOptimizer.MOEAFramework26.src.org.moeaframework.analysis.sensitivity.Negater.java
@SuppressWarnings("static-access") @Override/* w w w.ja v a 2 s . com*/ public Options getOptions() { Options options = super.getOptions(); options.addOption( OptionBuilder.withLongOpt("direction").hasArg().withArgName("d1,d2,...").isRequired().create('d')); return options; }