本文整理汇总了Java中org.apache.commons.cli.HelpFormatter.setWidth方法的典型用法代码示例。如果您正苦于以下问题:Java HelpFormatter.setWidth方法的具体用法?Java HelpFormatter.setWidth怎么用?Java HelpFormatter.setWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.cli.HelpFormatter
的用法示例。
在下文中一共展示了HelpFormatter.setWidth方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseCmdLine
import org.apache.commons.cli.HelpFormatter; //导入方法依赖的package包/类
public static CommandLine parseCmdLine(final String appName, String[] args, Options options,
CommandLineParser parser) {
HelpFormatter hf = new HelpFormatter();
hf.setWidth(110);
CommandLine commandLine = null;
try {
commandLine = parser.parse(options, args);
if (commandLine.hasOption('h')) {
hf.printHelp(appName, options, true);
return null;
}
} catch (ParseException e) {
hf.printHelp(appName, options, true);
}
return commandLine;
}
示例2: printUsage
import org.apache.commons.cli.HelpFormatter; //导入方法依赖的package包/类
/**
* Prints usage
*
* @param options
* the CLI Options
*/
private static void printUsage(Options options) {
// automatically generate the help statement
HelpFormatter formatter = new HelpFormatter();
formatter.setWidth(400);
String fromAceqlServerScript = System.getProperty("from.aceql-server.script");
String help = null;
if (fromAceqlServerScript != null && fromAceqlServerScript.equals("true")) {
help = "aceql-server -start -host <hostname> -port <port> -properties <file>" + CR_LF + "or " + CR_LF
+ "-stop -port <port> ";
} else {
help = "java org.kawanfw.sql.WebServer -start -host <hostname> -port <port> -properties <file>" + CR_LF
+ "or " + CR_LF + "-stop -port <port> ";
}
formatter.printHelp(help, options);
System.out.println();
}
示例3: usage
import org.apache.commons.cli.HelpFormatter; //导入方法依赖的package包/类
private static void usage(CommandLine commandLine) {
// load basicOptions
_Options();
HelpFormatter formatter = new HelpFormatter();
formatter.setWidth(120);
// print out license info prior to formatter.
System.out.println(
"Apktool v" + Androlib.getVersion() + " - a tool for reengineering Android apk files\n" +
"with smali v" + ApktoolProperties.get("smaliVersion") +
" and baksmali v" + ApktoolProperties.get("baksmaliVersion") + "\n" +
"Copyright 2014 Ryszard Wiśniewski <[email protected]>\n" +
"Updated by Connor Tumbleson <[email protected]>\n");
if (isAdvanceMode()) {
System.out.println("Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)\n");
}else {
System.out.println("");
}
// 4 usage outputs (general, frameworks, decode, build)
formatter.printHelp("apktool " + verbosityHelp(), normalOptions);
formatter.printHelp("apktool " + verbosityHelp() + "if|install-framework [options] <framework.apk>", frameOptions);
formatter.printHelp("apktool " + verbosityHelp() + "d[ecode] [options] <file_apk>", DecodeOptions);
formatter.printHelp("apktool " + verbosityHelp() + "b[uild] [options] <app_path>", BuildOptions);
if (isAdvanceMode()) {
formatter.printHelp("apktool " + verbosityHelp() + "publicize-resources <file_path>",
"Make all framework resources public.", emptyOptions, null);
} else {
System.out.println("");
}
// print out more information
System.out.println(
"For additional info, see: http://ibotpeaches.github.io/Apktool/ \n"
+ "For smali/baksmali info, see: https://github.com/JesusFreke/smali");
}
示例4: testPrintWidth20DefaultFormatter
import org.apache.commons.cli.HelpFormatter; //导入方法依赖的package包/类
@Test
@Ignore
public void testPrintWidth20DefaultFormatter() throws Exception {
final HelpFormatter f = new HelpFormatter();
f.setWidth(20);
TerminalHelpPrinter.print(TerminalOptionsBuilder.options(), f);
}
示例5: 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);
}
示例6: showHelp
import org.apache.commons.cli.HelpFormatter; //导入方法依赖的package包/类
private static void showHelp(Options options) {
HelpFormatter formatter = new HelpFormatter();
formatter.setWidth(100);
formatter.printHelp(" ", options);
}
示例7: printCommandLineHelp
import org.apache.commons.cli.HelpFormatter; //导入方法依赖的package包/类
public static void printCommandLineHelp(final String appName, final Options options) {
HelpFormatter hf = new HelpFormatter();
hf.setWidth(110);
hf.printHelp(appName, options, true);
}
示例8: printHelp
import org.apache.commons.cli.HelpFormatter; //导入方法依赖的package包/类
private static void printHelp() {
HelpFormatter formatter = new HelpFormatter();
formatter.setWidth(150);
formatter.printHelp(Sample.class.getName(), OPTIONS);
}
示例9: printHelp
import org.apache.commons.cli.HelpFormatter; //导入方法依赖的package包/类
private static void printHelp() {
HelpFormatter formatter = new HelpFormatter();
formatter.setWidth(150);
formatter.printHelp(Test.class.getName(), OPTIONS);
}
示例10: printUsage
import org.apache.commons.cli.HelpFormatter; //导入方法依赖的package包/类
protected void printUsage(final String usageStr, final String usageHeader,
final String usageFooter) {
HelpFormatter helpFormatter = new HelpFormatter();
helpFormatter.setWidth(120);
helpFormatter.printHelp(usageStr, usageHeader, options, usageFooter);
}