本文整理了Java中org.kohsuke.args4j.CmdLineException.getParser()
方法的一些代码示例,展示了CmdLineException.getParser()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CmdLineException.getParser()
方法的具体详情如下:
包路径:org.kohsuke.args4j.CmdLineException
类名称:CmdLineException
方法名:getParser
[英]Obtains the CmdLineParser that triggered an exception.
Unless you have legacy OptionHandler that doesn't pass in this information when it throws an exception, this method should always return a non-null value.
[中]获取触发异常的CmdLineParser。
除非您的旧OptionHandler在抛出异常时不传递此信息,否则此方法应始终返回非null值。
代码示例来源:origin: GoogleCloudPlatform/java-docs-samples
public static void main(String[] args) throws IOException {
CryptFileCommands commands = new CryptFileCommands();
CmdLineParser parser = new CmdLineParser(commands);
try {
parser.parseArgument(args);
} catch (CmdLineException e) {
System.out.println(e);
System.out.println();
e.getParser().printUsage(System.out);
System.exit(1);
}
commands.command.run();
}
}
代码示例来源:origin: GoogleCloudPlatform/java-docs-samples
public static void main(String[] args) throws IOException, CmdLineException {
SnippetCommands commands = new SnippetCommands();
CmdLineParser parser = new CmdLineParser(commands);
try {
parser.parseArgument(args);
} catch (CmdLineException e) {
System.out.println(e);
System.out.println();
e.getParser().printUsage(System.err);
System.exit(1);
}
commands.command.run();
}
}
代码示例来源:origin: apache/asterixdb
public static void printUsage(CmdLineException e, OptionHandlerFilter filter, PrintStream out) {
out.println("ERROR: " + e.getMessage());
printUsage(e.getParser(), filter, out);
}
代码示例来源:origin: castlabs/dashencrypt
public static void main(String[] args) throws Exception {
System.out.println(TOOL);
Main m = new Main();
CmdLineParser parser = new CmdLineParser(m);
try {
parser.parseArgument(args);
m.setupLogger();
m.command.postProcessCmdLineArgs(new CmdLineParser(m.command));
m.command.run();
} catch (CmdLineException e) {
System.err.println(e.getMessage());
e.getParser().printSingleLineUsage(System.err);
System.err.println();
e.getParser().printUsage(System.err);
System.exit(1023);
}
}
代码示例来源:origin: angular/clutz
public static void main(String[] args) {
Options options = null;
try {
options = new Options(args);
} catch (CmdLineException e) {
System.err.println(e.getMessage());
System.err.println("Usage: clutz [options...] arguments...");
e.getParser().printUsage(System.err);
System.err.println();
System.exit(1);
}
try {
DeclarationGenerator generator = new DeclarationGenerator(options);
generator.generateDeclarations();
if (generator.hasErrors()) {
// Already reported through the print stream.
System.exit(2);
}
} catch (Exception e) {
e.printStackTrace(System.err);
System.err.println("Uncaught exception in clutz, exiting.");
System.exit(3);
}
System.exit(0);
}
代码示例来源:origin: angular/clutz
public static void main(String[] args) {
Options options = null;
try {
options = new Options(args);
} catch (CmdLineException e) {
System.err.println(e.getMessage());
System.err.println("Usage: gents [options...] arguments...");
e.getParser().printUsage(System.err);
System.err.println();
System.exit(1);
}
TypeScriptGenerator generator = null;
try {
generator = new TypeScriptGenerator(options);
generator.generateTypeScript();
if (generator.hasErrors()) {
// Already reported through the print stream.
System.exit(2);
}
} catch (Exception e) {
e.printStackTrace(System.err);
System.err.println("Uncaught exception in gents, exiting.");
System.exit(3);
}
System.exit(0);
}
代码示例来源:origin: apache/opennlp-sandbox
} catch (CmdLineException e) {
System.out.println(e.getMessage());
e.getParser().printUsage(System.out);
System.exit(1);
代码示例来源:origin: apache/opennlp-sandbox
} catch (CmdLineException e) {
System.out.println(e.getMessage());
e.getParser().printUsage(System.out);
System.exit(1);
代码示例来源:origin: org.jacoco/org.jacoco.cli
@Override
public int execute(PrintWriter out, final PrintWriter err)
throws Exception {
final CommandParser mainParser = new CommandParser(this);
try {
mainParser.parseArgument(args);
} catch (final CmdLineException e) {
((CommandParser) e.getParser()).getCommand().printHelp(err);
err.println();
err.println(e.getMessage());
return -1;
}
if (help) {
printHelp(out);
return 0;
}
if (command.help) {
command.printHelp(out);
return 0;
}
if (command.quiet) {
out = NUL;
}
return command.execute(out, err);
}
代码示例来源:origin: openimaj/openimaj
System.err.println(e1.getMessage());
System.err.println("Usage: java -jar JClusterQuantiser.jar [options...] [files...]");
e1.getParser().printUsage(System.err);
System.exit(1);
代码示例来源:origin: org.openimaj.tools/TwitterPreprocessingTool
System.err.println(e1.getMessage());
System.err.println("Usage: java -jar JClusterQuantiser.jar [options...] [files...]");
e1.getParser().printUsage(System.err);
System.exit(1);
内容来源于网络,如有侵权,请联系作者删除!