org.apache.commons.cli.Option.hasOptionalArg()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(193)

本文整理了Java中org.apache.commons.cli.Option.hasOptionalArg()方法的一些代码示例,展示了Option.hasOptionalArg()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Option.hasOptionalArg()方法的具体详情如下:
包路径:org.apache.commons.cli.Option
类名称:Option
方法名:hasOptionalArg

Option.hasOptionalArg介绍

暂无

代码示例

代码示例来源:origin: commons-cli/commons-cli

/**
 * Tells if the option can accept more arguments.
 * 
 * @return false if the maximum number of arguments is reached
 * @since 1.3
 */
boolean acceptsArg()
{
  return (hasArg() || hasArgs() || hasOptionalArg()) && (numberOfArgs <= 0 || values.size() < numberOfArgs);
}

代码示例来源:origin: commons-cli/commons-cli

if (opt.getValues() == null && !opt.hasOptionalArg())

代码示例来源:origin: commons-cli/commons-cli

private static void checkOption(Option option, String opt, String description, String longOpt, int numArgs,
                String argName,  boolean required, boolean optionalArg,
                char valueSeparator, Class<?> cls)
{
  assertEquals(opt, option.getOpt());
  assertEquals(description, option.getDescription());
  assertEquals(longOpt, option.getLongOpt());
  assertEquals(numArgs, option.getArgs());
  assertEquals(argName, option.getArgName());
  assertEquals(required, option.isRequired());
  assertEquals(optionalArg, option.hasOptionalArg());
  assertEquals(valueSeparator, option.getValueSeparator());
  assertEquals(cls,  option.getType());
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

/**
 * Tells if the option can accept more arguments.
 * 
 * @return false if the maximum number of arguments is reached
 * @since 1.3
 */
boolean acceptsArg()
{
  return (hasArg() || hasArgs() || hasOptionalArg()) && (numberOfArgs <= 0 || values.size() < numberOfArgs);
}

代码示例来源:origin: io.snappydata/gemfirexd-tools

if (option.hasOptionalArg()) {
 buff.append('[');
if (option.hasOptionalArg()) {
 buff.append(']');

代码示例来源:origin: jdillon/mvnsh

public MavenOptionCompleter() {
 mavenOptions().forEach(option -> {
  if (option.hasArg() || option.hasArgs() || option.hasOptionalArg()) {
   // TODO: adjust for options with arguments; for now omit
  }
  else {
   delegate.add("-" + option.getOpt());
   delegate.add("--" + option.getLongOpt());
  }
 });
}

代码示例来源:origin: org.cytoscape/cy-commons-cli

if ((opt.getValues() == null) && !opt.hasOptionalArg()) {
  throw new MissingArgumentException("Missing argument for option:" + opt.getKey());

代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.cli

if (opt.getValues() == null && !opt.hasOptionalArg())

代码示例来源:origin: cytoscape.corelibs/commons-cli-1-x-cytocape-custom

if ((opt.getValues() == null) && !opt.hasOptionalArg()) {
  throw new MissingArgumentException("Missing argument for option:" + opt.getKey());

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

if (opt.getValues() == null && !opt.hasOptionalArg())

代码示例来源:origin: io.snappydata/gemfirexd-tools

if (option.hasOptionalArg()) {
 optBuf.append('[');
if (option.hasOptionalArg()) {
 optBuf.append(']');

代码示例来源:origin: sdedit/sdedit

if (opt.getValues() == null && !opt.hasOptionalArg())

代码示例来源:origin: iterate-ch/cyberduck

continue;
if(o.hasOptionalArg()) {
  continue;

代码示例来源:origin: com.marklogic/mlcp

public CommandlineOption(Option opt)
    throws IllegalArgumentException {
  super(opt.getOpt(), opt.hasArg(), opt.getDescription());
  this.setLongOpt(opt.getLongOpt());
  this.setRequired(opt.isRequired());
  this.setArgName(opt.getArgName());
  this.setArgs(opt.getArgs());
  this.setOptionalArg(opt.hasOptionalArg());
  this.setType(opt.getType());
  this.setValueSeparator(opt.getValueSeparator());
}

相关文章