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


Java CmdLineException.printStackTrace方法代码示例

本文整理汇总了Java中org.kohsuke.args4j.CmdLineException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java CmdLineException.printStackTrace方法的具体用法?Java CmdLineException.printStackTrace怎么用?Java CmdLineException.printStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kohsuke.args4j.CmdLineException的用法示例。


在下文中一共展示了CmdLineException.printStackTrace方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import org.kohsuke.args4j.CmdLineException; //导入方法依赖的package包/类
public static void main(String[] args) throws ClassNotFoundException {

        // https://martin-thoma.com/how-to-parse-command-line-arguments-in-java/
        EBoardRender.Config config = new EBoardRender.Config();

        CmdLineParser parser = new CmdLineParser(  config );
        try {
            parser.parseArgument(args);
        } catch (CmdLineException e) {
            e.printStackTrace();
        }

        Configuration conf = Configuration.getInstance(config.getConfig());
            String command = conf.getCommand().trim().toUpperCase();
            CommandHandler commandHandler = conf.getCommandHandlerFactory().getCommandHandler(command);
            commandHandler.execute(conf);
    }
 
开发者ID:eamonfoy,项目名称:trello-to-markdown,代码行数:18,代码来源:EBoardRender.java

示例2: parseArguments

import org.kohsuke.args4j.CmdLineException; //导入方法依赖的package包/类
/**
 * This method will use args4j to parse the provided arguments and
 * will store information about the actor temporary.
 *
 * @param messageEvent The MessageEvent triggering this command.
 * @return True, if parsing was successful. False, if the parsing failed because of missing required arguments, ...
 */
public boolean parseArguments(ChannelMessageEvent messageEvent) {
	// Save Actor
	setActor(messageEvent.getUser());

	// Parse Arguments
	CmdLineParser parser = new CmdLineParser(this);

	// Disable parsing @ as files (is used to mention users)
	parser.getProperties().withAtSyntax(false);

	try {
		// Parse the arguments.
		parser.parseArgument(messageEvent.getMessage().split(" "));
		setParsedContent(getCommandContent(messageEvent));

		// Remove the Command from the parsedArguments
		getParsedArguments().remove(0);

	} catch (CmdLineException ex) {
		ex.printStackTrace();

		// Invalid Command Usage - Trigger Help?
		return false;
	}

	return true;
}
 
开发者ID:twitch4j,项目名称:twitch4j,代码行数:35,代码来源:Command.java

示例3: main

import org.kohsuke.args4j.CmdLineException; //导入方法依赖的package包/类
public static void main(String ... args) {
    VennDrawCLI vennDrawCLI = new VennDrawCLI();
    CmdLineParser parser = new CmdLineParser(vennDrawCLI);

    boolean showHelp = false;

    if (args.length == 0) showHelp = true;

    if (args.length == 1)
        if (args[0].equals("-h") || args[0].equals("--help") || args[0].equals("-v") || args[0].equals("--version") || args[0].equals("-?"))
            showHelp = true;

    if (!showHelp) {
        try {
            parser.parseArgument(args);
            vennDrawCLI.run();
        } catch (CmdLineException e) {
            e.printStackTrace();
            showHelp = true;
        }
    }

    if (showHelp) {
        System.out.println("VennDraw " + VersionResolver.getVersion());
        System.out.println("Git Commit: " + VersionResolver.getGitCommit());
        System.out.println("Build Date: " + VersionResolver.getBuildDate());
        System.out.println("\n");
        System.out.print("venndraw ");
        parser.printSingleLineUsage(System.out);
        System.out.println();
        System.out.println();
        parser.printUsage(System.out);
    }
}
 
开发者ID:informationsea,项目名称:VennDraw,代码行数:35,代码来源:VennDrawCLI.java

示例4: parseArgs

import org.kohsuke.args4j.CmdLineException; //导入方法依赖的package包/类
public static CmdLineParser parseArgs(String[] args, Object t) {
    CmdLineParser parser = new CmdLineParser(t);
    try {
        parser.parseArgument(args);
    } catch (CmdLineException e) {
        e.printStackTrace();
        System.err.println(e.getMessage());
        parser.printUsage(System.err);
        System.err.println();
        System.exit(1);
    }
    return parser;
}
 
开发者ID:shunfei,项目名称:indexr,代码行数:14,代码来源:RuntimeUtil.java

示例5: main

import org.kohsuke.args4j.CmdLineException; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
  ServerConfiguration configuration = new ServerConfiguration();
  CmdLineParser parser = new CmdLineParser(configuration);
  try {
    parser.parseArgument(args);
  } catch (CmdLineException e) {
    e.printStackTrace(System.err);
    printUsage(parser);
    return;
  }
  runServer(configuration);
}
 
开发者ID:apache,项目名称:beam,代码行数:13,代码来源:ReferenceRunnerJobServer.java


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