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

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

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

Option.setValueSeparator介绍

[英]Sets the value separator. For example if the argument value was a Java property, the value separator would be '='.
[中]设置值分隔符。例如,如果参数值是Java属性,则值分隔符应为“=”。

代码示例

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

option.setArgs(numberOfArgs);
option.setType(type);
option.setValueSeparator(valuesep);
option.setArgName(argName);

代码示例来源:origin: apache/ignite

cfg.setValueSeparator('=');
cfg.setType(String.class);
minTtl.setValueSeparator('=');
minTtl.setType(Long.class);
maxTtl.setValueSeparator('=');
maxTtl.setType(Long.class);
duration.setValueSeparator('=');
duration.setType(Long.class);
log.setValueSeparator('=');
log.setType(String.class);

代码示例来源:origin: apache/ignite

/**
   * Creates cli options.
   *
   * @return Command line options
   */
  private static Options createOptions() {
    Options options = new Options();

    OptionGroup grp = new OptionGroup();

    grp.setRequired(true);

    Option cfg = new Option(OPTION_CFG, null, true, "path to Spring XML configuration file.");

    cfg.setArgName("file");

    Option n = new Option(null, OPTION_N, true, "nodes count.");

    n.setValueSeparator('=');
    n.setType(Integer.class);

    grp.addOption(cfg);
    grp.addOption(n);

    options.addOptionGroup(grp);

    return options;
  }
}

代码示例来源:origin: bonitasoft/bonita-engine

private Options createOptions() {
  Options options = new Options();
  Option systemPropertyOption = new Option("D",
      "specify system property to override configuration from database.properties");
  systemPropertyOption.setArgName("property=value");
  systemPropertyOption.setValueSeparator('=');
  systemPropertyOption.setArgs(2);
  options.addOption(systemPropertyOption);
  options.addOption("f", "force", false, "Force push even if critical folders will be deleted");
  return options;
}

代码示例来源:origin: org.bonitasoft.platform/platform-setup

private Options createOptions() {
  Options options = new Options();
  Option systemPropertyOption = new Option("D",
      "specify system property to override configuration from database.properties");
  systemPropertyOption.setArgName("property=value");
  systemPropertyOption.setValueSeparator('=');
  systemPropertyOption.setArgs(2);
  options.addOption(systemPropertyOption);
  options.addOption("f", "force", false, "Force push even if critical folders will be deleted");
  return options;
}

代码示例来源:origin: org.apache.bookkeeper/bookkeeper-server

public RegenerateInterleavedStorageIndexFile() {
  super(CMD_REGENERATE_INTERLEAVED_STORAGE_INDEX_FILE);
  Option ledgerOption = new Option("l", "ledgerIds", true,
                   "Ledger(s) whose index needs to be regenerated."
                   + " Multiple can be specified, comma separated.");
  ledgerOption.setRequired(true);
  ledgerOption.setValueSeparator(',');
  ledgerOption.setArgs(Option.UNLIMITED_VALUES);
  opts.addOption(ledgerOption);
  opts.addOption("dryRun", false,
          "Process the entryLogger, but don't write anything.");
  opts.addOption("password", true,
          "The bookie stores the password in the index file, so we need it to regenerate. "
          + "This must match the value in the ledger metadata.");
  opts.addOption("b64password", true,
          "The password in base64 encoding, for cases where the password is not UTF-8.");
}

代码示例来源:origin: org.onebusaway/onebusaway-quickstart-mains

private static Options createOptions() {
 Options options = new Options();
 options.addOption(ARG_PORT, true, "port (default=8080)");
 options.addOption(WebappCommon.ARG_BUILD, false, "");
 options.addOption(WebappCommon.ARG_GTFS_PATH, true, "");
 options.addOption(WebappCommon.ARG_GTFS_REALTIME_TRIP_UPDATES_URL, true, "");
 options.addOption(WebappCommon.ARG_GTFS_REALTIME_VEHICLE_POSITIONS_URL,
   true, "");
 options.addOption(WebappCommon.ARG_GTFS_REALTIME_ALERTS_URL, true, "");
 options.addOption(WebappCommon.ARG_GTFS_REALTIME_REFRESH_INTERVAL, true, "");
 
 Option pOption = new Option("P", "use value for given property");
 pOption.setArgName("beanName.beanProperty=value");
 pOption.setArgs(2);
 pOption.setValueSeparator('=');
 options.addOption(pOption);
 return options;
}

代码示例来源:origin: OneBusAway/onebusaway-application-modules

private static Options createOptions() {
 Options options = new Options();
 options.addOption(ARG_PORT, true, "port (default=8080)");
 options.addOption(WebappCommon.ARG_BUILD, false, "");
 options.addOption(WebappCommon.ARG_GTFS_PATH, true, "");
 options.addOption(WebappCommon.ARG_GTFS_REALTIME_TRIP_UPDATES_URL, true, "");
 options.addOption(WebappCommon.ARG_GTFS_REALTIME_VEHICLE_POSITIONS_URL,
   true, "");
 options.addOption(WebappCommon.ARG_GTFS_REALTIME_ALERTS_URL, true, "");
 options.addOption(WebappCommon.ARG_GTFS_REALTIME_REFRESH_INTERVAL, true, "");
 
 Option pOption = new Option("P", "use value for given property");
 pOption.setArgName("beanName.beanProperty=value");
 pOption.setArgs(2);
 pOption.setValueSeparator('=');
 options.addOption(pOption);
 return options;
}

代码示例来源:origin: org.onebusaway/onebusaway-transit-data-federation-builder

protected void buildOptions(Options options) {
 options.addOption(ARG_USE_DATABASE_FOR_GTFS, false, "");
 options.addOption(ARG_SKIP_TO, true, "");
 options.addOption(ARG_ONLY, true, "");
 options.addOption(ARG_SKIP, true, "");
 options.addOption(ARG_INCLUDE, true, "");
 options.addOption(ARG_ONLY_IF_DNE, false, "");
 options.addOption(ARG_DATASOURCE_DRIVER_CLASS_NAME, true, "");
 options.addOption(ARG_DATASOURCE_URL, true, "");
 options.addOption(ARG_DATASOURCE_USERNAME, true, "");
 options.addOption(ARG_DATASOURCE_PASSWORD, true, "");
 options.addOption(ARG_BUNDLE_KEY, true, "");
 options.addOption(ARG_RANDOMIZE_CACHE_DIR, false, "");
 options.addOption(ARG_ADDITIONAL_RESOURCES_DIRECTORY, true, "");
 options.addOption(ARG_OSM, true, "");
 Option dOption = new Option("D", "use value for given property");
 dOption.setArgName("property=value");
 dOption.setArgs(2);
 dOption.setValueSeparator('=');
 options.addOption(dOption);
 Option pOption = new Option("P", "use value for given property");
 pOption.setArgName("beanName.beanProperty=value");
 pOption.setArgs(2);
 pOption.setValueSeparator('=');
 options.addOption(pOption);
}

代码示例来源:origin: OneBusAway/onebusaway-application-modules

protected void buildOptions(Options options) {
 options.addOption(ARG_USE_DATABASE_FOR_GTFS, false, "");
 options.addOption(ARG_SKIP_TO, true, "");
 options.addOption(ARG_ONLY, true, "");
 options.addOption(ARG_SKIP, true, "");
 options.addOption(ARG_INCLUDE, true, "");
 options.addOption(ARG_ONLY_IF_DNE, false, "");
 options.addOption(ARG_DATASOURCE_DRIVER_CLASS_NAME, true, "");
 options.addOption(ARG_DATASOURCE_URL, true, "");
 options.addOption(ARG_DATASOURCE_USERNAME, true, "");
 options.addOption(ARG_DATASOURCE_PASSWORD, true, "");
 options.addOption(ARG_BUNDLE_KEY, true, "");
 options.addOption(ARG_RANDOMIZE_CACHE_DIR, false, "");
 options.addOption(ARG_ADDITIONAL_RESOURCES_DIRECTORY, true, "");
 Option dOption = new Option("D", "use value for given property");
 dOption.setArgName("property=value");
 dOption.setArgs(2);
 dOption.setValueSeparator('=');
 options.addOption(dOption);
 Option pOption = new Option("P", "use value for given property");
 pOption.setArgName("beanName.beanProperty=value");
 pOption.setArgs(2);
 pOption.setValueSeparator('=');
 options.addOption(pOption);
}

代码示例来源:origin: org.apache.oozie/oozie-tools

private void addNewOption(String optionName, String argName, String details, Class type, boolean required,
             Character valueSeparator, boolean isUnlimited) {
  final Option option = new Option(optionName, true,
      details);
  option.setRequired(required);
  option.setArgName(argName);
  if (type != null) {
    option.setType(type);
  }
  if (valueSeparator != null) {
    option.setValueSeparator(valueSeparator);
  }
  if (isUnlimited) {
    option.setArgs(Option.UNLIMITED_VALUES);
  }
  options.addOption(option);
}

代码示例来源:origin: facebookarchive/linkbench

private static Options initializeOptions() {
 Options options = new Options();
 Option config = new Option("c", true, "Linkbench config file");
 config.setArgName("file");
 options.addOption(config);
 Option log = new Option("L", true, "Log to this file");
 log.setArgName("file");
 options.addOption(log);
 Option csvStats = new Option("csvstats", "csvstats", true,
                "CSV stats output");
 csvStats.setArgName("file");
 options.addOption(csvStats);
 Option csvStream = new Option("csvstream", "csvstream", true,
   "CSV streaming stats output");
 csvStream.setArgName("file");
 options.addOption(csvStream);
 options.addOption("l", false,
       "Execute loading stage of benchmark");
 options.addOption("r", false,
       "Execute request stage of benchmark");
 // Java-style properties to override config file
 // -Dkey=value
 Option property = new Option("D", "Override a config setting");
 property.setArgs(2);
 property.setArgName("property=value");
 property.setValueSeparator('=');
 options.addOption(property);
 return options;
}

代码示例来源:origin: org.apache.activemq/apollo-util

public Option op() {
  Option option = new Option( id!=null ? id : " ", description );
  option.setLongOpt(name);
  option.setRequired( required );
  option.setOptionalArg(optional);
  option.setType( type );
  option.setValueSeparator(sperator);
  if( arg !=null && args==-1 ) {
    args=1;
  }
  option.setArgs(args);
  option.setArgName(arg);
  return option;
}

代码示例来源:origin: fusesource/hawtjni

public Option op() {
  Option option = new Option( id!=null ? id : " ", description );
  option.setLongOpt(name);
  option.setRequired( required );
  option.setOptionalArg(optional);
  option.setType( type );
  option.setValueSeparator(sperator);
  if( arg !=null && args==-1 ) {
    args=1;
  }
  option.setArgs(args);
  option.setArgName(arg);
  return option;
}

代码示例来源:origin: org.fusesource.hawtjni/hawtjni-generator

public Option op() {
  Option option = new Option( id!=null ? id : " ", description );
  option.setLongOpt(name);
  option.setRequired( required );
  option.setOptionalArg(optional);
  option.setType( type );
  option.setValueSeparator(sperator);
  if( arg !=null && args==-1 ) {
    args=1;
  }
  option.setArgs(args);
  option.setArgName(arg);
  return option;
}

代码示例来源:origin: NationalSecurityAgency/datawave

/**
 * Creates an Option using OptionBuilder's State and the given parameters.
 *
 * @param opt
 *            short representation of the option
 * @param longOpt
 *            long representation of the option
 * @param desc
 *            descibes the function of the option
 * @return the new Option
 */
public Option create(final String opt, final String longOpt, final String desc) {
  final Option option = new Option(opt, desc);
  option.setLongOpt(longOpt);
  option.setArgs(args);
  option.setRequired(required);
  option.setOptionalArg(optionalArg);
  option.setType(type);
  option.setValueSeparator(valSeparator);
  
  return option;
}

代码示例来源:origin: org.wikibrainapi/wikibrain-utils

/**
   * Create an Option using the current settings and with
   * the specified Option <code>char</code>.
   *
   * @param opt the <code>java.lang.String</code> representation
   * of the Option
   *
   * @return the Option instance
   *
   * @throws IllegalArgumentException if <code>opt</code> is not
   * a valid character.  See Option.
   */
  public Option create(String opt) throws IllegalArgumentException
  {
    Option option = new Option(opt, description);

    // set the option properties
    option.setLongOpt(longopt);
    option.setRequired(required);
    option.setOptionalArg(optionalArg);
    option.setArgs(numberOfArgs);
    option.setType(type);
    option.setValueSeparator(valuesep);
    option.setArgName(argName);

    // return the Option instance
    return option;
  }
}

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

/**
   * Create an Option using the current settings and with
   * the specified Option <code>char</code>.
   *
   * @param opt the <code>java.lang.String</code> representation
   * of the Option
   * @return the Option instance
   * @throws IllegalArgumentException if <code>opt</code> is not
   * a valid character.  See Option.
   */
  public static Option create(String opt) throws IllegalArgumentException {
    // create the option
    Option option = new Option(opt, description);

    // set the option properties
    option.setLongOpt(longopt);
    option.setRequired(required);
    option.setOptionalArg(optionalArg);
    option.setArgs(numberOfArgs);
    option.setType(type);
    option.setValueSeparator(valuesep);
    option.setArgName(argName);

    // reset the OptionBuilder properties
    OptionBuilder.reset();

    // return the Option instance
    return option;
  }
}

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

/**
   * Create an Option using the current settings and with
   * the specified Option <code>char</code>.
   *
   * @param opt the <code>java.lang.String</code> representation
   * of the Option
   * @return the Option instance
   * @throws IllegalArgumentException if <code>opt</code> is not
   * a valid character.  See Option.
   */
  public static Option create(String opt) throws IllegalArgumentException {
    // create the option
    Option option = new Option(opt, description);

    // set the option properties
    option.setLongOpt(longopt);
    option.setRequired(required);
    option.setOptionalArg(optionalArg);
    option.setArgs(numberOfArgs);
    option.setType(type);
    option.setValueSeparator(valuesep);
    option.setArgName(argName);

    // reset the OptionBuilder properties
    OptionBuilder.reset();

    // return the Option instance
    return option;
  }
}

代码示例来源:origin: org.seedstack.seed/seed-core

CliModel(Set<Field> fields) {
  for (Field field : fields) {
    CliOption optionAnnotation = field.getAnnotation(CliOption.class);
    CliArgs argsAnnotation = field.getAnnotation(CliArgs.class);
    if (optionAnnotation != null) {
      Option option = new Option(
          optionAnnotation.name(),
          optionAnnotation.longName(),
          optionAnnotation.valueCount() > 0 || optionAnnotation.valueCount() == -1,
          optionAnnotation.description()
      );
      if (optionAnnotation.valueCount() == -1) {
        option.setArgs(Option.UNLIMITED_VALUES);
      } else if (optionAnnotation.valueCount() > 0) {
        option.setArgs(optionAnnotation.valueCount());
      }
      option.setValueSeparator(optionAnnotation.valueSeparator());
      option.setRequired(optionAnnotation.mandatory());
      option.setOptionalArg(!optionAnnotation.mandatoryValue());
      optionAnnotations.add(optionAnnotation);
      optionFields.add(field);
      options.addOption(option);
    } else if (argsAnnotation != null) {
      mandatoryArgsCount = argsAnnotation.mandatoryCount();
      argsField = field;
    }
  }
}

相关文章