private static Option option(int argCount, String shortName, String longName, String argName, String description) { Option option = OptionBuilder.hasArgs(argCount) .withArgName(argName) .withLongOpt(longName) .withDescription(description) .create(shortName); return option; }
private static Options buildGeneralOptions(Options opts) { Options r = new Options(); for (Object o : opts.getOptions()) r.addOption((Option) o); Option jar = OptionBuilder.withArgName("path").hasArg() .withDescription("topology jar of the submitted topology").create("jar"); r.addOption(jar); Option conf = OptionBuilder.withArgName("configuration file").hasArg() .withDescription("an application configuration file").create("conf"); r.addOption(conf); return r; }
public BeelineOptionsProcessor() { options.addOption(OptionBuilder.hasArg().withArgName("url").create('u')); options.addOption(OptionBuilder.hasArg().withArgName("username").create('n')); options.addOption(OptionBuilder.hasArg().withArgName("password").create('p')); }
private static Options buildGeneralOptions(Options opts) { Options r = new Options(); for (Object o : opts.getOptions()) r.addOption((Option) o); Option workerNum = OptionBuilder.withArgName("worker num per batch").hasArg() .withDescription("number of workers to upgrade").create("n"); r.addOption(workerNum); Option comp = OptionBuilder.withArgName("component to upgrade").hasArg() .withDescription("component id to upgrade, note that only one component is allowed at a time") .create("p"); r.addOption(comp); Option workers = OptionBuilder.withArgName("workers to upgrade").hasArg() .withDescription("workers to upgrade, in the format: host1:port1,host2:port2,...").create("w"); r.addOption(workers); return r; }
@SuppressWarnings("static-access") HiveMetastoreCli(Configuration configuration) { super("hivemetastore", true); this.port = MetastoreConf.getIntVar(configuration, ConfVars.SERVER_PORT); // -p port OPTIONS.addOption(OptionBuilder .hasArg() .withArgName("port") .withDescription("Hive Metastore port number, default:" + this.port) .create('p')); }
private static CommandLine parseArgs(String[] args) throws ParseException { Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("file") .withDescription("sequence file to read") .hasArg() .withArgName("<sequence_file_name>") .withType(String.class) .create("f")); options.addOption("o", "print_offsets_only", false, "whether to print only offsets " + "ignoring the message payload"); CommandLineParser parser = new GnuParser(); return parser.parse(options, args); }
static Options buildGeneralOptions(Options opts) { Options r = new Options(); for (Object o : opts.getOptions()) r.addOption((Option) o); Option libjars = OptionBuilder.withArgName("paths").hasArg().withDescription("comma separated jars to be used by the submitted topology").create("libjars"); r.addOption(libjars); optionProcessors.put("libjars", new LibjarsProcessor()); Option conf = OptionBuilder.withArgName("configuration file").hasArg().withDescription("an application configuration file").create("conf"); r.addOption(conf); optionProcessors.put("conf", new ConfFileProcessor()); // Must come after `conf': this option is of higher priority Option extraConfig = OptionBuilder.withArgName("D").hasArg().withDescription("extra configurations (preserving types)").create("D"); r.addOption(extraConfig); optionProcessors.put("D", new ExtraConfigProcessor()); return r; }
/** * Instantiates a new CLI options processor. */ @SuppressWarnings("static-access") public OptionsProcessor() { // -e 'quoted-query-string' options.addOption(OptionBuilder.hasArg() .withArgName("quoted-command-string") .withDescription("Remote command line").create('e')); // -h hostname/ippaddress options.addOption(OptionBuilder.hasArg().withArgName("hostname") .withDescription("connecting to Thrift Server on remote host") .create('h')); // -p port options.addOption(OptionBuilder.hasArg().withArgName("port") .withDescription("connecting to Thrift Server on port number") .create('p')); // -c 'thrift-config' options.addOption(OptionBuilder.hasArg().withArgName("thrift-config") .withDescription("Thrift property file").create('c')); // [-H|--help] options.addOption(new Option("H", "help", false, "Print help information")); }
/** * Create commandLine options * @return */ private static Options initCommandLineOptions(){ Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("gui") .withDescription("Start VectAlign GUI") .create(OPTION_GUI)); options.addOption(OptionBuilder.withLongOpt("start") .withDescription("Starting VectorDrawable path (\"string\", txt file or SVG file)") .hasArg() .withArgName("\"string\"|txt_file|svg_file") .create(OPTION_FROM)); options.addOption(OptionBuilder.withLongOpt("end") .withDescription("Ending VectorDrawable path (\"string\", txt file or SVG file)") .hasArg() .withArgName("\"string\"|txt_file|svg_file") .create(OPTION_TO)); options.addOption(OptionBuilder.withLongOpt("mode") .withDescription("Aligning technique (default is BASE)") .hasArg() .withArgName("BASE|LINEAR|SUB_BASE|SUB_LINEAR") .create(OPTION_MODE)); options.addOption(OptionBuilder.withLongOpt("version") .withDescription("Print the version of the application") .create(OPTION_VERSION)); options.addOption(OptionBuilder.withLongOpt("help").create(OPTION_HELP)); return options; }
synchronized (OptionBuilder.class) { Options options = new Options(); Option oconf = OptionBuilder.withArgName("configuration file") .hasArg() .withDescription("specify an application configuration file") .withLongOpt(ARG_CONF) .create(ARG_CONF_SHORT); Option confclass = OptionBuilder.withArgName("configuration classname") .hasArg() .withDescription( "Classname of a Hadoop Configuration subclass to load") .withLongOpt(ARG_CONFCLASS) .create(ARG_CONFCLASS_SHORT); Option property = OptionBuilder.withArgName("property=value") .hasArg() .withDescription("use value for given property") .create('D'); options.addOption(oconf); options.addOption(property); options.addOption(confclass); return options;
public CliOptionsProcessor() { options.addOption(OptionBuilder.hasArg().withArgName("databasename").withLongOpt("database") .withDescription("Specify the database to use").create()); options.addOption(OptionBuilder.hasArg().withArgName("quoted-query-string").withDescription ("SQL from command line").create('e')); options.addOption(OptionBuilder.hasArg().withArgName("filename").withDescription("SQL from " + "files").create('f')); options.addOption(OptionBuilder.hasArg().withArgName("filename").withDescription ("Initialization SQL file").create('i')); options.addOption(OptionBuilder.withValueSeparator().hasArgs(2).withArgName("property=value") .withLongOpt("hiveconf").withDescription("Use value for given property").create()); options.addOption(OptionBuilder.withValueSeparator().hasArgs(2).withArgName("key=value") .withLongOpt("define").withDescription("Variable substitution to apply to Hive commands. e" + ".g. -d A=B or --define A=B").create('d')); options.addOption(OptionBuilder.withValueSeparator().hasArgs(2).withArgName("key=value") .withLongOpt("hivevar").withDescription("Variable substitution to apply to Hive commands. " + "e.g. --hivevar A=B").create());
@Nonnull private Options getOptions() { Options options = new Options(); options.addOption("c", true, "Continue processing even if one of the JSON configuration file is invalid."); options.addOption("j", true, "Directory where json configuration is stored. Default is ."); options.addOption("f", true, "A single json file to execute."); options.addOption("e", false, "Run endlessly. Default false."); options.addOption("s", true, "Seconds between server job runs (not defined with cron). Default: 60"); options.addOption(OptionBuilder .withArgName("a") .withLongOpt("additionalJars") .hasArgs() .withValueSeparator(',') .withDescription("Comma delimited list of additional jars to add to the class path") .create("a")); options.addOption("h", false, "Help"); return options; } }
private static CommandLine parseArgs(String[] args) throws ParseException { Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("command") .withDescription("command name. One of \"delete_committed_offsets\"") .hasArg() .withArgName("<command>") .withType(String.class) .create("c")); options.addOption(OptionBuilder.withLongOpt("topic") .withDescription("topic whose offset should be read") .hasArg() .withArgName("<topic>") .withType(String.class) .create("t")); options.addOption(OptionBuilder.withLongOpt("partition") .withDescription("kafka partition whose offset should be read") .hasArg() .withArgName("<partition>") .withType(Number.class) .create("p")); CommandLineParser parser = new GnuParser(); return parser.parse(options, args); }
/** * Create an instance with common options (help, verbose, etc...). * * @param cliname the name of the command * @param includeHiveConf include "hiveconf" as an option if true */ @SuppressWarnings("static-access") public CommonCliOptions(String cliname, boolean includeHiveConf) { this.cliname = cliname; // [-v|--verbose] OPTIONS.addOption(new Option("v", "verbose", false, "Verbose mode")); // [-h|--help] OPTIONS.addOption(new Option("h", "help", false, "Print help information")); if (includeHiveConf) { OPTIONS.addOption(OptionBuilder .withValueSeparator() .hasArgs(2) .withArgName("property=value") .withLongOpt("hiveconf") .withDescription("Use value for given property") .create()); } }
/** * Create an instance with common options (help, verbose, etc...). * * @param cliname the name of the command * @param includeHiveConf include "hiveconf" as an option if true */ @SuppressWarnings("static-access") public CommonCliOptions(String cliname, boolean includeHiveConf) { this.cliname = cliname; // [-v|--verbose] OPTIONS.addOption(new Option("v", "verbose", false, "Verbose mode")); // [-h|--help] OPTIONS.addOption(new Option("h", "help", false, "Print help information")); if (includeHiveConf) { OPTIONS.addOption(OptionBuilder .withValueSeparator() .hasArgs(2) .withArgName("property=value") .withLongOpt("hiveconf") .withDescription("Use value for given property") .create()); } }
this.serverName = serverName; options.addOption(OptionBuilder .withValueSeparator() .hasArgs(2) .withArgName("property=value") .withLongOpt("hiveconf") .withDescription("Use value for given property") .create()); options.addOption(OptionBuilder .hasArgs(1) .withArgName("versionNumber") .withLongOpt("deregister") .withDescription("Deregister all instances of given version from dynamic service discovery") .create()); options.addOption(OptionBuilder .hasArgs(0) .withLongOpt("listHAPeers") .withDescription("List all HS2 instances when running in Active Passive HA mode") .create()); options.addOption(OptionBuilder .hasArgs(1) .withArgName("workerIdentity") .withLongOpt("failover") .withDescription("Manually failover Active HS2 instance to passive standby mode")
static Options createOptions() { Options result = new Options(); result.addOption(OptionBuilder .withLongOpt("location") .withDescription("HS2 url") .hasArg() .create('l')); result.addOption(OptionBuilder .withLongOpt("user") .withDescription("user name") .hasArg() .create('u')); result.addOption(OptionBuilder .withLongOpt("pwd") .withDescription("password") .hasArg() .create('p')); result.addOption(OptionBuilder .withValueSeparator() .hasArgs(2) .withArgName("property=value") .withLongOpt("hiveconf") .withDescription("Use value for given property")
private static CommandLine parseArgs(String[] args) throws ParseException { Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("topic") .withDescription("kafka topic name") .hasArg() .withArgName("<topic>") .withType(String.class) .create("t")); options.addOption(OptionBuilder.withLongOpt("start_offset") .withDescription("offset identifying the first set of files to check") .hasArg() .withArgName("<offset>") .withType(Long.class) .create("s")); options.addOption(OptionBuilder.withLongOpt("end_offset") .withDescription("offset identifying the last set of files to check") .hasArg() .withArgName("<offset>") .withType(Long.class) .create("e")); options.addOption(OptionBuilder.withLongOpt("messages") .withDescription("expected number of messages") .hasArg() .withArgName("<num_messages>") .withType(Number.class) .create("m"));
options.addOption(OptionBuilder .hasArg() .withArgName("databasename") .withLongOpt("database") .withDescription("Specify the database to use") .create()); options.addOption(OptionBuilder .hasArg() .withArgName("quoted-query-string") .withDescription("SQL from command line") .create('e')); options.addOption(OptionBuilder .hasArg() .withArgName("filename") .withDescription("SQL from files") .create('f')); .withArgName("filename") .withValueSeparator() .hasArgs(2) .withArgName("property=value") .withLongOpt("hiveconf") .withValueSeparator() .hasArgs(2) .withArgName("key=value")
protected Options buildGeneralOptions(Options opts) { synchronized (OptionBuilder.class) { Option fs = OptionBuilder.withArgName("file:///|hdfs://namenode:port") .hasArg() .withDescription("specify default filesystem URL to use, " + "overrides 'fs.defaultFS' property from configurations.") .create("fs"); Option jt = OptionBuilder.withArgName("local|resourcemanager:port") .hasArg() .withDescription("specify a ResourceManager") .create("jt"); Option oconf = OptionBuilder.withArgName("configuration file") .hasArg() .withDescription("specify an application configuration file") .create("conf"); Option property = OptionBuilder.withArgName("property=value") Option libjars = OptionBuilder.withArgName("paths") Option files = OptionBuilder.withArgName("paths") Option archives = OptionBuilder.withArgName("paths") Option tokensFile = OptionBuilder.withArgName("tokensFile") opts.addOption(fs); opts.addOption(jt); opts.addOption(oconf);