List of usage examples for org.apache.commons.cli Option UNLIMITED_VALUES
int UNLIMITED_VALUES
To view the source code for org.apache.commons.cli Option UNLIMITED_VALUES.
Click Source Link
From source file:de.uni_koblenz.ist.utilities.option_handler.OptionHandler.java
/** * Used by the method getUsageString for adding an Option to the String. * //from w ww . j a va 2 s.c o m * @param out * The StringBuilder to write into. * @param current * The option to add. */ private void appendOption(StringBuilder out, Option current) { out.append("-"); out.append(current.getOpt()); int numberOfArgs = current.getArgs(); out.append(" "); if (current.hasOptionalArg()) { out.append("["); } if (numberOfArgs == Option.UNLIMITED_VALUES) { appendArgName(out, current); out.append("{"); out.append(current.getValueSeparator()); appendArgName(out, current); out.append("}"); } if (numberOfArgs >= 1) { appendArgName(out, current); for (int i = 1; i < numberOfArgs; i++) { out.append(current.getValueSeparator()); appendArgName(out, current); } } if (current.hasOptionalArg()) { out.append("]"); } }
From source file:at.ac.tuwien.ims.latex2mobiformulaconv.app.Main.java
private static void initializeOptions() { options = new Options(); Option inputOption = new Option("i", "inputPaths", true, "inputPaths file"); inputOption.setRequired(true);//from www .ja v a 2s.c o m inputOption.setArgs(Option.UNLIMITED_VALUES); inputOption.setOptionalArg(false); inputOption.setValueSeparator(','); options.addOption(inputOption); options.addOption("f", "filename", true, "output filename"); options.addOption("o", "output-dir", true, "output directory"); options.addOption("m", "export-markup", false, "export html markup"); options.addOption("n", "no-mobi", false, "no Mobi conversion, just markup, NOTE: makes -m implicit!"); options.addOption("t", "title", true, "Document title"); options.addOption("h", "help", false, "show this help"); options.addOption("d", "debugMarkupOutput", false, "show debug output in html markup"); options.addOption("u", "use-calibre", false, "use calibre ebook-convert instead of kindlegen"); Option picturesOption = new Option("r", "replace latex formulas with pictures, override html"); picturesOption.setLongOpt("replace-with-images"); picturesOption.setArgs(0); picturesOption.setRequired(false); options.addOption(picturesOption); // implementation specific options options.addOption( ((LatexToHtmlConverter) applicationContext.getBean("latex2html-converter")).getExecOption()); options.addOption( ((HtmlToMobiConverter) applicationContext.getBean(KINDLEGEN_HTML2MOBI_CONVERTER)).getExecOption()); options.addOption( ((HtmlToMobiConverter) applicationContext.getBean(CALIBRE_HTML2MOBI_CONVERTER)).getExecOption()); }
From source file:de.uni_koblenz.jgralab.utilities.tgmerge.TGMerge.java
private static CommandLine processCommandLineOptions(String[] args) { String toolString = "java " + TGMerge.class.getName(); String versionString = JGraLab.getInfo(false); OptionHandler oh = new OptionHandler(toolString, versionString); Option output = new Option("o", "outTG", true, "(required): output TG file"); output.setRequired(true);/* w w w. j av a 2s . c om*/ output.setArgName("outputTG"); oh.addOption(output); oh.setArgumentCount(Option.UNLIMITED_VALUES); oh.setArgumentName("inputTG"); oh.setOptionalArgument(false); return oh.parse(args); }
From source file:com.alibaba.jstorm.yarn.utils.JstormYarnUtils.java
public static Options initClientOptions() { Options opts = new Options(); opts.addOption(JOYConstants.APP_NAME_KEY, true, "Application Name. Default value - com.alibaba.jstorm.yarn.JstormOnYarn"); opts.addOption(JOYConstants.PRIORITY, true, "Application Priority. Default 0"); opts.addOption(JOYConstants.PRIORITY, true, "RM Queue in which this application is to be submitted"); opts.addOption(JOYConstants.TIMEOUT, true, "Application timeout in milliseconds"); opts.addOption(JOYConstants.MASTER_MEMORY, true, "Amount of memory in MB to be requested to run the application master"); opts.addOption(JOYConstants.MASTER_VCORES, true, "Amount of virtual cores to be requested to run the application master"); opts.addOption(JOYConstants.JAR, true, "Jar file containing the application master"); opts.addOption(JOYConstants.LIB_JAR, true, "dependency lib"); opts.addOption(JOYConstants.HOME_DIR, true, "home "); opts.addOption(JOYConstants.CONF_FILE, true, " path of jstorm-yarn.xml "); opts.addOption(JOYConstants.RM_ADDRESS, true, "resource manager address eg hostname:port"); opts.addOption(JOYConstants.NN_ADDRESS, true, "nameNode address eg hostname:port"); opts.addOption(JOYConstants.HADOOP_CONF_DIR, true, "hadoop config directory which contains hdfs-site.xml/core-site" + ".xml/yarn-site.xml"); opts.addOption(JOYConstants.INSTANCE_NAME, true, "instance name , which is path of registry"); opts.addOption(JOYConstants.DEPLOY_PATH, true, "deploy dir on HDFS "); opts.addOption(JOYConstants.SHELL_SCRIPT, true, "Location of the shell script to be " + "executed. Can only specify either --shell_command or --shell_script"); opts.addOption(JOYConstants.SHELL_ARGS, true, "Command line args for the shell script." + "Multiple args can be separated by empty space."); opts.getOption(JOYConstants.SHELL_ARGS).setArgs(Option.UNLIMITED_VALUES); opts.addOption(JOYConstants.SHELL_ENV, true, "Environment for shell script. Specified as env_key=env_val pairs"); opts.addOption(JOYConstants.SHELL_CMD_PRIORITY, true, "Priority for the shell command containers"); opts.addOption(JOYConstants.CONTAINER_MEMORY, true, "Amount of memory in MB to be requested to run the shell command"); opts.addOption(JOYConstants.CONTAINER_VCORES, true, "Amount of virtual cores to be requested to run the shell command"); opts.addOption(JOYConstants.NUM_CONTAINERS, true, "No. of containers on which the shell command needs to be executed"); opts.addOption(JOYConstants.LOG_PROPERTIES, true, "log4j.properties file"); opts.addOption(JOYConstants.KEEP_CONTAINERS_ACROSS_APPLICATION_ATTEMPTS, false, "Flag to indicate whether to keep containers across application attempts." + " If the flag is true, running containers will not be killed when" + " application attempt fails and these containers will be retrieved by" + " the new application attempt "); opts.addOption(JOYConstants.ATTEMPT_FAILURES_VALIDITY_INTERVAL, true, "when attempt_failures_validity_interval in milliseconds is set to > 0," + "the failure number will not take failures which happen out of " + "the validityInterval into failure count. " + "If failure count reaches to maxAppAttempts, " + "the application will be failed."); opts.addOption(JOYConstants.DEBUG, false, "Dump out debug information"); opts.addOption(JOYConstants.DOMAIN, true, "ID of the timeline domain where the " + "timeline entities will be put"); opts.addOption(JOYConstants.VIEW_ACLS, true, "Users and groups that allowed to " + "view the timeline entities in the given domain"); opts.addOption(JOYConstants.MODIFY_ACLS, true, "Users and groups that allowed to " + "modify the timeline entities in the given domain"); opts.addOption(JOYConstants.CREATE, false, "Flag to indicate whether to create the " + "domain specified with -domain."); opts.addOption(JOYConstants.HELP, false, "Print usage"); opts.addOption(JOYConstants.NODE_LABEL_EXPRESSION, true, "Node label expression to determine the nodes" + " where all the containers of this application" + " will be allocated, \"\" means containers" + " can be allocated anywhere, if you don't specify the option," + " default node_label_expression of queue will be used."); return opts;/* w ww .j a va 2 s . c o m*/ }
From source file:com.basistech.lucene.tools.LuceneQueryTool.java
private static Options createOptions() { Options options = new Options(); Option option;/*from ww w . j a va 2 s .c om*/ option = new Option("i", "index", true, "index (required, multiple -i searches multiple indexes)"); option.setRequired(true); options.addOption(option); option = new Option("q", "query", true, "(query | %all | %enumerate-fields " + "| %count-fields " + "| %enumerate-terms field " + "| %script scriptFile " + "| %ids id [id ...] | %id-file file) (required, scriptFile may contain -q and -o)"); option.setRequired(true); option.setArgs(Option.UNLIMITED_VALUES); options.addOption(option); option = new Option(null, "regex", true, "filter query by regex, syntax is field:/regex/"); option.setArgs(1); options.addOption(option); option = new Option(null, "fields", true, "fields to include in output (defaults to all)"); option.setArgs(Option.UNLIMITED_VALUES); options.addOption(option); option = new Option(null, "sort-fields", false, "sort fields within document"); options.addOption(option); option = new Option(null, "query-limit", true, "max number of query hits to process"); option.setArgs(1); options.addOption(option); option = new Option(null, "output-limit", true, "max number of docs to output"); option.setArgs(1); options.addOption(option); option = new Option(null, "analyzer", true, "for query, (KeywordAnalyzer | StandardAnalyzer) (defaults to KeywordAnalyzer)"); option.setArgs(1); options.addOption(option); option = new Option(null, "query-field", true, "default field for query"); option.setArgs(1); options.addOption(option); option = new Option(null, "show-id", false, "show Lucene document id in results"); options.addOption(option); option = new Option(null, "show-score", false, "show score in results"); options.addOption(option); option = new Option(null, "show-hits", false, "show total hit count"); options.addOption(option); option = new Option(null, "suppress-names", false, "suppress printing of field names"); options.addOption(option); option = new Option(null, "tabular", false, "print tabular output " + "(requires --fields with no multivalued fields)"); options.addOption(option); option = new Option("o", "output", true, "output file (defaults to standard output)"); option.setArgs(1); options.addOption(option); return options; }
From source file:org.apache.accumulo.core.util.shell.commands.FateCommand.java
@Override public Options getOptions() { final Options o = new Options(); secretOption = new Option("s", "secret", true, "specify the instance secret to use"); secretOption.setOptionalArg(false);/*from w w w. j a v a 2 s. c o m*/ o.addOption(secretOption); statusOption = new Option("t", "status-type", true, "filter 'print' on the transaction status type(s) {NEW, IN_PROGRESS, FAILED_IN_PROGRESS, FAILED, SUCCESSFUL}"); statusOption.setArgs(Option.UNLIMITED_VALUES); statusOption.setOptionalArg(false); o.addOption(statusOption); return o; }
From source file:org.apache.accumulo.core.util.shell.commands.ScriptCommand.java
@Override public Options getOptions() { final Options o = new Options(); engine = new Option("e", "engine", false, "engine name, defaults to JDK default (Rhino)"); engine.setArgName("engineName"); engine.setArgs(1);//w ww .j a v a 2 s . c o m engine.setRequired(false); o.addOption(engine); OptionGroup inputGroup = new OptionGroup(); list = new Option("l", "list", false, "list available script engines"); inputGroup.addOption(list); script = new Option("s", "script", true, "use inline script"); script.setArgName("script text"); script.setArgs(1); script.setRequired(false); inputGroup.addOption(script); file = new Option("f", "file", true, "use script file"); file.setArgName("fileName"); file.setArgs(1); file.setRequired(false); inputGroup.addOption(file); inputGroup.setRequired(true); o.addOptionGroup(inputGroup); OptionGroup invokeGroup = new OptionGroup(); object = new Option("obj", "object", true, "name of object"); object.setArgs(1); object.setArgName("objectName:methodName"); object.setRequired(false); invokeGroup.addOption(object); function = new Option("fx", "function", true, "invoke a script function"); function.setArgName("functionName"); function.setArgs(1); function.setRequired(false); invokeGroup.addOption(function); invokeGroup.setRequired(false); o.addOptionGroup(invokeGroup); args = new Option("a", "args", true, "comma separated list of key=value arguments"); args.setArgName("property1=value1,propert2=value2,..."); args.setArgs(Option.UNLIMITED_VALUES); args.setRequired(false); o.addOption(args); out = new Option("o", "output", true, "output file"); out.setArgName("fileName"); out.setArgs(1); out.setRequired(false); o.addOption(out); return o; }
From source file:org.apache.accumulo.shell.commands.FateCommand.java
@Override public Options getOptions() { final Options o = new Options(); secretOption = new Option("s", "secret", true, "specify the instance secret to use"); secretOption.setOptionalArg(false);/*from ww w . j a v a 2 s. c om*/ o.addOption(secretOption); statusOption = new Option("t", "status-type", true, "filter 'print' on the transaction status type(s) {NEW, IN_PROGRESS, FAILED_IN_PROGRESS, FAILED, SUCCESSFUL}"); statusOption.setArgs(Option.UNLIMITED_VALUES); statusOption.setOptionalArg(false); o.addOption(statusOption); disablePaginationOpt = new Option("np", "no-pagination", false, "disables pagination of output"); o.addOption(disablePaginationOpt); return o; }
From source file:org.apache.hadoop.mpich.MpichContainerWrapper.java
public MpichContainerWrapper() { opts = new Options(); opts.addOption("ioServer", true, "Hostname where the stdout and stderr " + "will be redirected"); opts.addOption("ioServerPort", true, "Port required for a socket" + " redirecting IO"); opts.addOption("exec", true, "The actual executable to launch"); opts.addOption("np", true, "Number of Processes"); opts.addOption("rank", true, "Rank of the process, it is set by AM"); opts.addOption("pmiid", true, "The unique id of the process"); opts.addOption("pmiServer", true, "PMI Server hostname"); opts.addOption("pmiServerPort", true, "Port required by NIODev to share" + "wireup information"); opts.addOption("isSpawn", false, "Specify whether the process is the spawn one"); opts.addOption("appArgs", true, "Specifies the User Application args"); opts.getOption("appArgs").setArgs(Option.UNLIMITED_VALUES); }
From source file:org.apache.hadoop.yarn.applications.amonly.Client.java
Client(String appMasterMainClass, Configuration conf) { this.conf = conf; this.appMasterMainClass = appMasterMainClass; yarnClient = YarnClient.createYarnClient(); yarnClient.init(conf);/*from w w w. j ava 2s .c om*/ opts = new Options(); opts.addOption("appname", true, "Application Name. Default value - DistributedShell"); opts.addOption("priority", true, "Application Priority. Default 0"); opts.addOption("queue", true, "RM Queue in which this application is to be submitted"); opts.addOption("timeout", true, "Application timeout in milliseconds"); opts.addOption("master_memory", true, "Amount of memory in MB to be requested to run the application master"); opts.addOption("master_vcores", true, "Amount of virtual cores to be requested to run the application master"); opts.addOption("jar", true, "Jar file containing the application master"); opts.addOption("shell_command", true, "Shell command to be executed by " + "the Application Master. Can only specify either --shell_command " + "or --shell_script"); opts.addOption("shell_script", true, "Location of the shell script to be " + "executed. Can only specify either --shell_command or --shell_script"); opts.addOption("shell_args", true, "Command line args for the shell script." + "Multiple args can be separated by empty space."); opts.getOption("shell_args").setArgs(Option.UNLIMITED_VALUES); opts.addOption("shell_env", true, "Environment for shell script. Specified as env_key=env_val pairs"); opts.addOption("shell_cmd_priority", true, "Priority for the shell command containers"); opts.addOption("container_memory", true, "Amount of memory in MB to be requested to run the shell command"); opts.addOption("container_vcores", true, "Amount of virtual cores to be requested to run the shell command"); opts.addOption("num_containers", true, "No. of containers on which the shell command needs to be executed"); opts.addOption("log_properties", true, "log4j.properties file"); opts.addOption("keep_containers_across_application_attempts", false, "Flag to indicate whether to keep containers across application attempts." + " If the flag is true, running containers will not be killed when" + " application attempt fails and these containers will be retrieved by" + " the new application attempt "); opts.addOption("attempt_failures_validity_interval", true, "when attempt_failures_validity_interval in milliseconds is set to > 0," + "the failure number will not take failures which happen out of " + "the validityInterval into failure count. " + "If failure count reaches to maxAppAttempts, " + "the application will be failed."); opts.addOption("debug", false, "Dump out debug information"); opts.addOption("domain", true, "ID of the timeline domain where the " + "timeline entities will be put"); opts.addOption("view_acls", true, "Users and groups that allowed to " + "view the timeline entities in the given domain"); opts.addOption("modify_acls", true, "Users and groups that allowed to " + "modify the timeline entities in the given domain"); opts.addOption("create", false, "Flag to indicate whether to create the " + "domain specified with -domain."); opts.addOption("help", false, "Print usage"); opts.addOption("node_label_expression", true, "Node label expression to determine the nodes" + " where all the containers of this application" + " will be allocated, \"\" means containers" + " can be allocated anywhere, if you don't specify the option," + " default node_label_expression of queue will be used."); }