本文整理汇总了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);
}
示例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);
}
示例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);
}