• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java OptionHandlerFilter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.kohsuke.args4j.OptionHandlerFilter的典型用法代码示例。如果您正苦于以下问题:Java OptionHandlerFilter类的具体用法?Java OptionHandlerFilter怎么用?Java OptionHandlerFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



OptionHandlerFilter类属于org.kohsuke.args4j包,在下文中一共展示了OptionHandlerFilter类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: parseArgs

import org.kohsuke.args4j.OptionHandlerFilter; //导入依赖的package包/类
/**
 * Parses the tool' arguments
 *
 * @param args
 *          Arguments to parse.
 */
protected void parseArgs(final String[] args) {
  final CmdLineParser parser = new CmdLineParser(this);
  try {
    parser.parseArgument(args);
  } catch (final CmdLineException e) {
    parser.printUsage(stderr);
    exit("Failed to parse args", e);
  }

  if (help) {
    // User asked for help screen
    parser.printUsage(stderr);
    stderr.println();
    stderr.print(parser.printExample(OptionHandlerFilter.REQUIRED));
    exit(0);
  }
}
 
开发者ID:quelltextlich,项目名称:jacoco-toolbox,代码行数:24,代码来源:Tool.java


示例2: printCategoryUsage

import org.kohsuke.args4j.OptionHandlerFilter; //导入依赖的package包/类
private void printCategoryUsage(
    String categoryName,
    final Collection<String> options,
    OutputStreamWriter outputStream,
    String prefix,
    String suffix) {

  try {
    if (prefix != null) {
      printStringLineWrapped(prefix, outputStream);
    }

    outputStream.write(boldPrefix + categoryName + ":\n" + normalPrefix);

    parser.printUsage(
        outputStream,
        null,
        new OptionHandlerFilter() {
          @Override
          public boolean select(OptionHandler optionHandler) {
            if (optionHandler.option instanceof NamedOptionDef) {
              return !optionHandler.option.hidden()
                  && options.contains(
                      ((NamedOptionDef) optionHandler.option).name().replaceFirst("^--", ""));
            }
            return false;
          }
        });

    if (suffix != null) {
      printStringLineWrapped(suffix, outputStream);
    }
  } catch (IOException e) {
    // Ignore.
  }
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:37,代码来源:CommandLineRunner.java


示例3: checkParameters

import org.kohsuke.args4j.OptionHandlerFilter; //导入依赖的package包/类
private boolean checkParameters(String[] args) {
	CmdLineParser parser = new CmdLineParser(this);

       parser.setUsageWidth(80);

       try {
           // parse the arguments.
           parser.parseArgument(args);
           
           if(!Constants.JSON_OUTPUT_FORMAT.equals(fileExtension) && !Constants.XML_OUTPUT_FORMAT.equals(fileExtension)){
           	throw new CmdLineException(parser,"Output format should be either 'xml' or 'json'");
           }
           if(scanDifferenceFilePath != null){
           	generateDiff = true;
           }
           
           if(!generateDiff && fullScanResultFilePath == null){
           	throw new CmdLineException(parser,"You need to specify at least one expected result '-d' and/or '-f' options");
           }
           

       }catch(CmdLineException e) {
           // if there's a problem in the command line,
           // you'll get this exception. this will report
           // an error message.
       	Logger.error(e.getMessage());
       	Logger.error("java -jar "+Constants.APPLICATION_NAME+" [options...] arguments...");
           // print the list of available options
           parser.printUsage(System.err);
           Logger.error("");

           // print option sample. This is useful some time
           Logger.error(" Example: java -jar "+Constants.APPLICATION_NAME+parser.printExample(OptionHandlerFilter.ALL));

           return false;
       }	
       return true;
}
 
开发者ID:gzussa,项目名称:dir-analyzer,代码行数:39,代码来源:DirAnalyzer.java


示例4: getUsageString

import org.kohsuke.args4j.OptionHandlerFilter; //导入依赖的package包/类
private static String getUsageString(CmdLineParser parser, boolean showAll) {
    ResourceBundle rb = getResourceBundle();
    StringWriter writer = new StringWriter();
    writer.write(formatMessage(rb, "usage", getVersionString(), PROGRAM_NAME));
    parser.printUsage(writer, rb, showAll ? OptionHandlerFilter.ALL : OptionHandlerFilter.PUBLIC);
    return writer.toString();
}
 
开发者ID:anba,项目名称:es6draft,代码行数:8,代码来源:Repl.java


示例5: execute

import org.kohsuke.args4j.OptionHandlerFilter; //导入依赖的package包/类
@Override
public void execute(Configuration conf, String[] args) throws Exception {
    CmdLineParser parser = new CmdLineParser(this);
    
    String keyId = conf.get("fs.s3n.awsAccessKeyId");
    String keySecret = conf.get("fs.s3n.awsSecretAccessKey");
    
    s3 = new AmazonS3Client(new BasicAWSCredentials(keyId, keySecret));
    
    try {
        parser.parseArgument(args);
        
        ExecutorService executor = Executors.newFixedThreadPool(threads);
        List<Future> futures = new ArrayList<Future>();
        
        BufferedReader fin = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF8"));
        
        try {
            for(String line = fin.readLine(); line != null; line = fin.readLine()) {
                futures.add(executor.submit(new FileCheckTask(new Path(line.trim()))));
            }
        } finally {
            fin.close();
        }
        
        for(Future f : futures) {
            f.get();
        }
        
        executor.shutdown();
    } catch (CmdLineException e) {
        System.err.println(e.getMessage());
        System.err.println("s3mper fs verify [options]");
        // print the list of available options
        parser.printUsage(System.err);
        System.err.println();

        System.err.println(" Example: s3mper fs verify "+parser.printExample(OptionHandlerFilter.ALL));
    }
}
 
开发者ID:Netflix,项目名称:s3mper,代码行数:41,代码来源:FileSystemVerifyCommand.java


示例6: execute

import org.kohsuke.args4j.OptionHandlerFilter; //导入依赖的package包/类
@Override
public void execute(Configuration conf, String[] args) throws Exception {
    CmdLineParser parser = new CmdLineParser(this);
    
    try {
        parser.parseArgument(args);
    } catch (CmdLineException e) {
        System.err.println(e.getMessage());
        System.err.println("s3mper meta delete_ts [options]");
        // print the list of available options
        parser.printUsage(System.err);
        System.err.println();

        System.err.println(" Example: s3mper meta delete_ts "+parser.printExample(OptionHandlerFilter.ALL));

        return;
    }
    
    MetastoreJanitor janitor = new MetastoreJanitor();
    janitor.initalize(PathUtil.S3N, conf);
    janitor.setScanLimit(readUnits);
    janitor.setDeleteLimit(writeUnits);
    janitor.setScanThreads(scanThreads);
    janitor.setDeleteThreads(deleteThreads);
    
    janitor.deleteTimeseries(TimeUnit.valueOf(unitType.toUpperCase()), unitCount);
}
 
开发者ID:Netflix,项目名称:s3mper,代码行数:28,代码来源:MetastoreTimeseriesDeleteCommand.java


示例7: execute

import org.kohsuke.args4j.OptionHandlerFilter; //导入依赖的package包/类
@Override
public void execute(Configuration conf, String[] args) throws Exception {
    CmdLineParser parser = new CmdLineParser(this);
    
    try {
        parser.parseArgument(args);
    } catch (CmdLineException e) {
        System.err.println(e.getMessage());
        System.err.println("java SampleMain [options...] arguments...");
        // print the list of available options
        parser.printUsage(System.err);
        System.err.println();

        System.err.println(" Example: s3mper metastore "+parser.printExample(OptionHandlerFilter.ALL));

        return;
    }
    
    MetastoreJanitor janitor = new MetastoreJanitor();
    janitor.initalize(PathUtil.S3N, conf);
    janitor.setScanLimit(readUnits);
    janitor.setDeleteLimit(writeUnits);
    janitor.setScanThreads(scanThreads);
    janitor.setDeleteThreads(deleteThreads);
    
    janitor.deletePaths(TimeUnit.valueOf(unitType.toUpperCase()), unitCount);
}
 
开发者ID:Netflix,项目名称:s3mper,代码行数:28,代码来源:MetastorePathDeleteCommand.java


示例8: doMain

import org.kohsuke.args4j.OptionHandlerFilter; //导入依赖的package包/类
public void doMain(String[] args) throws IOException {

		CmdLineParser parser = new CmdLineParser(this);

		// if you have a wider console, you could increase the value;
		// here 80 is also the default
		parser.setUsageWidth(80);

		try {
			// parse the arguments.
			parser.parseArgument(args);

		} catch (CmdLineException e) {
			// if there's a problem in the command line,
			// you'll get this exception. this will report
			// an error message.
			System.err.println(e.getMessage());
			System.err.println("java SimpleBot [options...] arguments...");
			// print the list of available options
			parser.printUsage(System.err);
			System.err.println();

			// print option sample. This is useful some time
			System.err.println("  Example: java SampleMain" + parser.printExample(OptionHandlerFilter.REQUIRED));

			return;
		}


		OkHttpClient client = new OkHttpClient();
		final MMBot bot = MMBot.logIn(client, this.mattermostServer, this.login, this.pwd);

		for (String bugzilla : bugzillas) {
			bot.onMessage(new RespondWithBugzillaReferences(bugzilla));
		}

		for (String gerrit : gerrits) {
			bot.onMessage(new RespondWithGerritReferences(gerrit));
		}

		if (twitterAccessToken != null && twitterAccessTokenSecret != null && twitterConsumerKey != null
				&& twitterConsumerSecret != null) {
			ConfigurationBuilder cb = new ConfigurationBuilder();

			cb.setOAuthConsumerKey(this.twitterConsumerKey).setOAuthConsumerSecret(this.twitterConsumerSecret)
					.setOAuthAccessToken(this.twitterAccessToken)
					.setOAuthAccessTokenSecret(this.twitterAccessTokenSecret);
			TwitterFactory tf = new TwitterFactory(cb.build());
			Twitter twitter = tf.getInstance();
			bot.onMessage(new RespondWithTwitterReferences(twitter));
		}
		
		bot.onMessage(new RespondWithGiphyAnimation());
		bot.onMessage(new RespondWithPullRequestsReferences());

		bot.listen();

	}
 
开发者ID:cbrun,项目名称:jstuart,代码行数:59,代码来源:SimpleBot.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GetContainerStatusesRequestPBImpl类代码示例发布时间:2022-05-22
下一篇:
Java SwedishAnalyzer类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap