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