當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。