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


Java HelpFormatter.setOptionComparator方法代码示例

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


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

示例1: printHelp

import org.apache.commons.cli.HelpFormatter; //导入方法依赖的package包/类
public void printHelp() {
    HelpFormatter formatter = new HelpFormatter();
    formatter.setSyntaxPrefix("Usage: ");
    formatter.setOptionComparator(null);

    String columns = System.getenv(ENV_COLUMNS);
    if (columns != null) {
        try {
            formatter.setWidth(Integer.parseInt(columns));
        } catch (Exception e) {
            logger.warn(e.toString());
        }
    }

    String header = "Run the " + VersionInfo.PRODUCT + " standalone command-line application.\n\n";
    String leftPadding = StringUtils.repeat(' ', formatter.getLeftPadding());
    //@formatter:off
    String footer = new StringBuilder()
            .append("\nExamples (change directory to " + VersionInfo.PRODUCT + " bin/ first):\n")
            .append(leftPadding + "./" + EXECUTABLE_NAME + " -c ../examples/script/py/hello_world.xml\n")
            .append(leftPadding + "./" + EXECUTABLE_NAME + " -k helloWorldKb=../examples/script/py/hello_world.py\n")
            .append(leftPadding + "./" + EXECUTABLE_NAME + " -k ../examples/script/py/hello_world.py\n")
            .append(leftPadding + "./" + EXECUTABLE_NAME
                    + " -k filtersKb=../examples/script/py/filters.py -k heartbeatKb=../examples/script/js/rules_heartbeat.js\n")
            .append(leftPadding + "./" + EXECUTABLE_NAME
                    + " -k ../examples/standalone/multiple_kb_files/event_processors.py"
                    + ",../examples/standalone/multiple_kb_files/example2.py\n")
            .append("\nPress CTRL+C to exit the " + VersionInfo.PRODUCT + " standalone command-line application.\n")
            .append("\nSee http://sponge.openksavi.org for more details.").toString();
    //@formatter:on
    formatter.printHelp(EXECUTABLE_NAME, header, options, footer, true);
}
 
开发者ID:softelnet,项目名称:sponge,代码行数:33,代码来源:StandaloneEngineBuilder.java

示例2: help

import org.apache.commons.cli.HelpFormatter; //导入方法依赖的package包/类
static void help() {
    HelpFormatter formatter = new HelpFormatter();
    formatter.setDescPadding(0);
    formatter.setOptionComparator(null);
    System.out.println("CLI\n"
            + "Invoke command line options  for retrieving execution details, setting variable, change settings etc.");
    formatter.printHelp("\nRun.bat", LookUp.OPTIONS, true);
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:9,代码来源:CLI.java

示例3: printHelp

import org.apache.commons.cli.HelpFormatter; //导入方法依赖的package包/类
@SuppressWarnings({"rawtypes", "unchecked"})
private static void printHelp(Options options) {
  StringBuilder helpFooter = new StringBuilder();
  helpFooter.append("Examples: \n");
  helpFooter.append("config_upgrade.sh -c schema.xml -t schema -u solr_4_to_5_processors.xml -d /tmp/result-dir \n");
  helpFooter.append("config_upgrade.sh --dry-run -c schema.xml -t schema -u solr_4_to_5_processors.xml -d /tmp/result-dir \n");

  HelpFormatter formatter = new HelpFormatter();
  formatter.setOptionComparator(new OptionComarator());
  formatter.printHelp("ConfigUpgradeTool", null, options, helpFooter.toString(), false);
}
 
开发者ID:hgadre,项目名称:solr-upgrade-tool,代码行数:12,代码来源:ConfigUpgradeTool.java


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