当前位置: 首页>>代码示例>>Java>>正文


Java OptionBuilder.hasArgs方法代码示例

本文整理汇总了Java中org.apache.commons.cli.OptionBuilder.hasArgs方法的典型用法代码示例。如果您正苦于以下问题:Java OptionBuilder.hasArgs方法的具体用法?Java OptionBuilder.hasArgs怎么用?Java OptionBuilder.hasArgs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.cli.OptionBuilder的用法示例。


在下文中一共展示了OptionBuilder.hasArgs方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildOptions

import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
/**
 * Build command-line options and descriptions
 *
 * @return command line options
 */
public static Options buildOptions() {
  Options options = new Options();

  // Build in/output file arguments, which are required, but there is no 
  // addOption method that can specify this
  OptionBuilder.isRequired();
  OptionBuilder.hasArgs();
  OptionBuilder.withLongOpt("outputFilename");
  options.addOption(OptionBuilder.create("o"));
  
  OptionBuilder.isRequired();
  OptionBuilder.hasArgs();
  OptionBuilder.withLongOpt("inputFilename");
  options.addOption(OptionBuilder.create("i"));
  
  options.addOption("p", "processor", true, "");
  options.addOption("v", "verbose", false, "");
  options.addOption("f", "fix-txids", false, "");
  options.addOption("r", "recover", false, "");
  options.addOption("h", "help", false, "");

  return options;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:29,代码来源:OfflineEditsViewer.java

示例2: buildOptions

import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
/**
 * Build command-line options and descriptions
 */
public static Options buildOptions() {
  Options options = new Options();

  // Build in/output file arguments, which are required, but there is no 
  // addOption method that can specify this
  OptionBuilder.isRequired();
  OptionBuilder.hasArgs();
  OptionBuilder.withLongOpt("outputFile");
  options.addOption(OptionBuilder.create("o"));
  
  OptionBuilder.isRequired();
  OptionBuilder.hasArgs();
  OptionBuilder.withLongOpt("inputFile");
  options.addOption(OptionBuilder.create("i"));
  
  options.addOption("p", "processor", true, "");
  options.addOption("h", "help", false, "");
  options.addOption("skipBlocks", false, "");
  options.addOption("printToScreen", false, "");
  options.addOption("delimiter", true, "");

  return options;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:OfflineImageViewer.java

示例3: buildOptions

import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
/**
 * Build command-line options and descriptions
 */
private static Options buildOptions() {
  Options options = new Options();

  // Build in/output file arguments, which are required, but there is no
  // addOption method that can specify this
  OptionBuilder.isRequired();
  OptionBuilder.hasArgs();
  OptionBuilder.withLongOpt("inputFile");
  options.addOption(OptionBuilder.create("i"));

  options.addOption("o", "outputFile", true, "");
  options.addOption("p", "processor", true, "");
  options.addOption("h", "help", false, "");
  options.addOption("maxSize", true, "");
  options.addOption("step", true, "");
  options.addOption("addr", true, "");
  options.addOption("delimiter", true, "");
  options.addOption("t", "temp", true, "");

  return options;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:OfflineImageViewerPB.java

示例4: main

import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
/**
 * Runs the resolve urls tool.
 */
public static void main(String[] args) {

  Options options = new Options();
  OptionBuilder.withArgName("help");
  OptionBuilder.withDescription("show this help message");
  Option helpOpts = OptionBuilder.create("help");
  options.addOption(helpOpts);

  OptionBuilder.withArgName("urls");
  OptionBuilder.hasArg();
  OptionBuilder.withDescription("the urls file to check");
  Option urlOpts = OptionBuilder.create("urls");
  options.addOption(urlOpts);

  OptionBuilder.withArgName("numThreads");
  OptionBuilder.hasArgs();
  OptionBuilder.withDescription("the number of threads to use");
  Option numThreadOpts = OptionBuilder.create("numThreads");
  options.addOption(numThreadOpts);

  CommandLineParser parser = new GnuParser();
  try {
    // parse out common line arguments
    CommandLine line = parser.parse(options, args);
    if (line.hasOption("help") || !line.hasOption("urls")) {
      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp("ResolveUrls", options);
      return;
    }

    // get the urls and the number of threads and start the resolver
    String urls = line.getOptionValue("urls");
    int numThreads = 100;
    String numThreadsStr = line.getOptionValue("numThreads");
    if (numThreadsStr != null) {
      numThreads = Integer.parseInt(numThreadsStr);
    }
    ResolveUrls resolve = new ResolveUrls(urls, numThreads);
    resolve.resolveUrls();
  } catch (Exception e) {
    LOG.error("ResolveUrls: " + StringUtils.stringifyException(e));
  }
}
 
开发者ID:jorcox,项目名称:GeoCrawler,代码行数:47,代码来源:ResolveUrls.java


注:本文中的org.apache.commons.cli.OptionBuilder.hasArgs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。