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


Java HelpFormatter.setWidth方法代码示例

本文整理汇总了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;
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:18,代码来源:ServerUtil.java

示例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();
}
 
开发者ID:kawansoft,项目名称:aceql-http,代码行数:27,代码来源:WebServer.java

示例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");
    }
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:38,代码来源:Main.java

示例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);
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:8,代码来源:TerminalHelpPrinterTest.java

示例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);
}
 
开发者ID:softelnet,项目名称:sponge,代码行数:33,代码来源:StandaloneEngineBuilder.java

示例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);
}
 
开发者ID:Maschell,项目名称:nn_nex_logging_and_research,代码行数:6,代码来源:StarterSymbolExporter.java

示例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);
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:6,代码来源:ServerUtil.java

示例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);
}
 
开发者ID:comdirect,项目名称:hadoop-logfile-inputformat,代码行数:6,代码来源:Sample.java

示例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);
}
 
开发者ID:comdirect,项目名称:hadoop-logfile-inputformat,代码行数:6,代码来源:Test.java

示例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);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:7,代码来源:AbstractHBaseTool.java


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