本文整理匯總了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);
}