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


Java OptionBuilder.withDescription方法代码示例

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


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

示例1: AddFind

import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
public AddFind() {
	super("add", "a");

	OptionBuilder.withArgName("outputDir");
	OptionBuilder.withLongOpt("output");
	OptionBuilder.hasArg();
	OptionBuilder.withDescription("override default download directory");
	OptionBuilder.withType(File.class);
	getOptions().addOption(OptionBuilder.create('o'));
	getOptions().addOption("r", "recurse", false,
			"recurse sub-directories.");
	getOptions().addOption("f", "find", false,
			"only find files, don't add.");
	getOptions().addOption("h", "help", false,
			"display help about this command");
	getOptions()
			.addOption("l", "list", false, "list previous find results");
}
 
开发者ID:thangbn,项目名称:Direct-File-Downloader,代码行数:19,代码来源:AddFind.java

示例2: createOptions

import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
private static Options createOptions() {
  Options options = new Options();

  OptionBuilder.withDescription("Show this help");
  options.addOption(OptionBuilder.create(CMD_HELP));

  OptionBuilder.withArgName("port");
  OptionBuilder.hasOptionalArg();
  OptionBuilder.withDescription("The port to run the Nutch Server. Default port 8081");
  options.addOption(OptionBuilder.create(CMD_PORT));

  OptionBuilder.withArgName("host");
  OptionBuilder.hasOptionalArg();
  OptionBuilder.withDescription("The host to bind the Nutch Server to. Default is localhost.");
  options.addOption(OptionBuilder.create(CMD_HOST));

  return options;
}
 
开发者ID:jorcox,项目名称:GeoCrawler,代码行数:19,代码来源:NutchServer.java

示例3: AddFind

import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
public AddFind()
{
	super("add", "a");

	OptionBuilder.withArgName("outputDir");
	OptionBuilder.withLongOpt("output");
	OptionBuilder.hasArg();
	OptionBuilder.withDescription("override default download directory");
	OptionBuilder.withType(File.class);
	getOptions().addOption( OptionBuilder.create('o') );
	getOptions().addOption("r", "recurse", false, "recurse sub-directories.");
	getOptions().addOption("f", "find", false, "only find files, don't add.");
	getOptions().addOption("h", "help", false, "display help about this command");
	getOptions().addOption("l", "list", false, "list previous find results");
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:16,代码来源:AddFind.java

示例4: createCommandLineOptions

import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
/**
 * Creates the command line structure / options.
 *
 * @return the command line {@link Options}
 */
private static Options createCommandLineOptions() {
  Options options = new Options();
  
  OptionBuilder.withLongOpt("keyword-properties");
  OptionBuilder.withDescription("Location of the keyword-optimizer.properties file.");
  OptionBuilder.hasArg(true);
  OptionBuilder.withArgName("file");
  options.addOption(OptionBuilder.create("kp"));

  OptionBuilder.withLongOpt("ads-properties");
  OptionBuilder.withDescription("Location of the ads.properties file.");
  OptionBuilder.hasArg(true);
  OptionBuilder.withArgName("file");
  options.addOption(OptionBuilder.create("ap"));

  OptionBuilder.withLongOpt("port");
  OptionBuilder.withDescription("Port for the REST HTTP server.");
  OptionBuilder.hasArg(true);
  OptionBuilder.withArgName("port");
  options.addOption(OptionBuilder.create("p"));
  
  OptionBuilder.withLongOpt("context-path");
  OptionBuilder.withDescription("Context path for the REST HTTP server.");
  OptionBuilder.hasArg(true);
  OptionBuilder.withArgName("path");
  options.addOption(OptionBuilder.create("cp"));
  
  return options;
}
 
开发者ID:googleads,项目名称:keyword-optimizer,代码行数:35,代码来源:ApiServer.java

示例5: run

import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
/**
 * Runs the LinkRank tool.
 */
public int run(String[] args) throws Exception {

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

  OptionBuilder.withArgName("webgraphdb");
  OptionBuilder.hasArg();
  OptionBuilder.withDescription("the web graph db to use");
  Option webgraphOpts = OptionBuilder.create("webgraphdb");
  options.addOption(webgraphOpts);

  CommandLineParser parser = new GnuParser();
  try {

    CommandLine line = parser.parse(options, args);
    if (line.hasOption("help") || !line.hasOption("webgraphdb")) {
      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp("LinkRank", options);
      return -1;
    }

    String webGraphDb = line.getOptionValue("webgraphdb");

    analyze(new Path(webGraphDb));
    return 0;
  } catch (Exception e) {
    LOG.error("LinkAnalysis: " + StringUtils.stringifyException(e));
    return -2;
  }
}
 
开发者ID:jorcox,项目名称:GeoCrawler,代码行数:37,代码来源:LinkRank.java

示例6: run

import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
/**
 * Runs the LinkDumper tool. This simply creates the database, to read the
 * values the nested Reader tool must be used.
 */
public int run(String[] args) throws Exception {

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

  OptionBuilder.withArgName("webgraphdb");
  OptionBuilder.hasArg();
  OptionBuilder.withDescription("the web graph database to use");
  Option webGraphDbOpts = OptionBuilder.create("webgraphdb");
  options.addOption(webGraphDbOpts);

  CommandLineParser parser = new GnuParser();
  try {

    CommandLine line = parser.parse(options, args);
    if (line.hasOption("help") || !line.hasOption("webgraphdb")) {
      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp("LinkDumper", options);
      return -1;
    }

    String webGraphDb = line.getOptionValue("webgraphdb");
    dumpLinks(new Path(webGraphDb));
    return 0;
  } catch (Exception e) {
    LOG.error("LinkDumper: " + StringUtils.stringifyException(e));
    return -2;
  }
}
 
开发者ID:jorcox,项目名称:GeoCrawler,代码行数:37,代码来源:LinkDumper.java

示例7: createWebAppOptions

import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
private static Options createWebAppOptions() {
  Options options = new Options();
  Option helpOpt = new Option("h", "help", false, "show this help message");
  OptionBuilder.withDescription("Port to run the WebApplication on.");
  OptionBuilder.hasOptionalArg();
  OptionBuilder.withArgName("port number");
  options.addOption(OptionBuilder.create(CMD_PORT));
  options.addOption(helpOpt);
  return options;
}
 
开发者ID:jorcox,项目名称:GeoCrawler,代码行数:11,代码来源:NutchUiServer.java

示例8: createCommandLineOptions

import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
/**
 * Creates the command line options.
 *
 * @return the {@link Options}
 */
private static Options createCommandLineOptions() {
  Options options = new Options();

  OptionBuilder.withArgName("help");
  OptionBuilder.hasArg(false);
  OptionBuilder.withDescription("print this message");
  OptionBuilder.isRequired(false);
  options.addOption(OptionBuilder.create("help"));

  OptionBuilder.withArgName("file");
  OptionBuilder.hasArg(true);
  OptionBuilder.withDescription("aw-report-alerting-sample.properties file.");
  OptionBuilder.isRequired(false);
  options.addOption(OptionBuilder.create("file"));

  OptionBuilder.withArgName("accountIdsFile");
  OptionBuilder.hasArg(true);
  OptionBuilder.withDescription(
      "Consider ONLY the account IDs specified on the file to run the report");
  OptionBuilder.isRequired(false);
  options.addOption(OptionBuilder.create("accountIdsFile"));

  OptionBuilder.withArgName("debug");
  OptionBuilder.hasArg(false);
  OptionBuilder.withDescription("Will display all the debug information. "
      + "If the option 'verbose' is activated, "
      + "all the information will be displayed on the console as well");
  OptionBuilder.isRequired(false);
  options.addOption(OptionBuilder.create("debug"));

  return options;
}
 
开发者ID:googleads,项目名称:adwords-alerting,代码行数:38,代码来源:AwAlerting.java

示例9: buildOptions

import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
/**
 * Method for building the allowed options.
 * @param options Options object for adding the options created with OptionBuilder.
 */
private void buildOptions(Options options){        
    OptionBuilder.withArgName(OPTION_HELP);
    OptionBuilder.withLongOpt(OPTION_HELP);
    OptionBuilder.isRequired(false);
    OptionBuilder.withDescription("Print help message and exit.");
    options.addOption(OptionBuilder.create('h'));
    
    OptionBuilder.withArgName(OPTION_INPUT_JSON);
    OptionBuilder.withLongOpt(OPTION_INPUT_JSON);
    OptionBuilder.isRequired(false);
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("Specify the JSON input file.");
    options.addOption(OptionBuilder.create("j"));
}
 
开发者ID:openmainframeproject,项目名称:ade,代码行数:19,代码来源:UpdateGroups.java

示例10: addPlatformSpecificOptions

import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
@Override
public void addPlatformSpecificOptions(Options options){
    OptionBuilder.withArgName(OPTION_YEAR);
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("year of messages in Linux syslogs");
    options.addOption(OptionBuilder.create(OPTION_YEAR));
}
 
开发者ID:openmainframeproject,项目名称:ade,代码行数:8,代码来源:LinuxOptions.java

示例11: parseArgs

import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
/**
 * Method to parse specific arguments for "Upload".
 * 
 * @throws AdeException 
 * 
 */
protected final void parseArgs(String[] args) throws AdeException {
    final Options options = new Options();

    OptionBuilder.withArgName(OPTION_DUMP_PARSE_REPORT);
    OptionBuilder.isRequired(false);
    OptionBuilder.withDescription("Specify this option to generate parse report");
    options.addOption(OptionBuilder.create(OPTION_DUMP_PARSE_REPORT));

    final CommandLine line = super.parseArgs(options, args);

    if (line.hasOption(OPTION_DUMP_PARSE_REPORT)) {
        getAdeExtProperties().setParseReportRequested(true);
    }
}
 
开发者ID:openmainframeproject,项目名称:ade,代码行数:21,代码来源:Upload.java

示例12: parseArgs

import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
/**
 * Method to parse specific arguments for "Analyze".
 */
@Override
protected final void parseArgs(String[] args) throws AdeException {
    final Options options = new Options();

    OptionBuilder.withArgName(OPTION_SOURCES);
    OptionBuilder.withLongOpt(OPTION_SOURCES);
    OptionBuilder.isRequired(false);
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("Specify the Source to be analyzed.  ");
    options.addOption(OptionBuilder.create("s"));

    super.parseArgs(options, args);

}
 
开发者ID:openmainframeproject,项目名称:ade,代码行数:18,代码来源:Analyze.java

示例13: parseArgs

import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
/**
 * parse args
 */
private static CommandLine parseArgs(Options opts, String... args)
throws IllegalArgumentException {

  OptionBuilder.withArgName("NameNode|DataNode");
  OptionBuilder.hasArg();
  OptionBuilder.withDescription("specify jmx service (NameNode by default)");
  Option jmx_service = OptionBuilder.create("service");

  OptionBuilder.withArgName("mbean server");
  OptionBuilder.hasArg();
  OptionBuilder
  .withDescription("specify mbean server (localhost by default)");
  Option jmx_server = OptionBuilder.create("server");

  OptionBuilder.withDescription("print help");
  Option jmx_help = OptionBuilder.create("help");

  OptionBuilder.withArgName("mbean server port");
  OptionBuilder.hasArg();
  OptionBuilder.withDescription("specify mbean server port, "
      + "if missing - it will try to connect to MBean Server in the same VM");
  Option jmx_port = OptionBuilder.create("port");

  OptionBuilder.withArgName("VM's connector url");
  OptionBuilder.hasArg();
  OptionBuilder.withDescription("connect to the VM on the same machine;"
      + "\n use:\n jstat -J-Djstat.showUnsupported=true -snap <vmpid> | "
      + "grep sun.management.JMXConnectorServer.address\n "
      + "to find the url");
  Option jmx_localVM = OptionBuilder.create("localVM");

  opts.addOption(jmx_server);
  opts.addOption(jmx_help);
  opts.addOption(jmx_service);
  opts.addOption(jmx_port);
  opts.addOption(jmx_localVM);

  CommandLine commandLine = null;
  CommandLineParser parser = new GnuParser();
  try {
    commandLine = parser.parse(opts, args, true);
  } catch (ParseException e) {
    printUsage(opts);
    throw new IllegalArgumentException("invalid args: " + e.getMessage());
  }
  return commandLine;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:51,代码来源:JMXGet.java

示例14: 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

示例15: run

import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
/**
 * Runs the ScoreUpdater tool.
 */
public int run(String[] args) throws Exception {

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

  OptionBuilder.withArgName("crawldb");
  OptionBuilder.hasArg();
  OptionBuilder.withDescription("the crawldb to use");
  Option crawlDbOpts = OptionBuilder.create("crawldb");
  options.addOption(crawlDbOpts);

  OptionBuilder.withArgName("webgraphdb");
  OptionBuilder.hasArg();
  OptionBuilder.withDescription("the webgraphdb to use");
  Option webGraphOpts = OptionBuilder.create("webgraphdb");
  options.addOption(webGraphOpts);

  CommandLineParser parser = new GnuParser();
  try {

    CommandLine line = parser.parse(options, args);
    if (line.hasOption("help") || !line.hasOption("webgraphdb")
        || !line.hasOption("crawldb")) {
      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp("ScoreUpdater", options);
      return -1;
    }

    String crawlDb = line.getOptionValue("crawldb");
    String webGraphDb = line.getOptionValue("webgraphdb");
    update(new Path(crawlDb), new Path(webGraphDb));
    return 0;
  } catch (Exception e) {
    LOG.error("ScoreUpdater: " + StringUtils.stringifyException(e));
    return -1;
  }
}
 
开发者ID:jorcox,项目名称:GeoCrawler,代码行数:44,代码来源:ScoreUpdater.java


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