Add --stacktrace option

This commit is contained in:
Paul Schaub 2022-11-06 14:41:52 +01:00
parent c32ef9830b
commit fd4c22cde6
Signed by: vanitasvitae
GPG Key ID: 62BEE9264BF17311
2 changed files with 10 additions and 1 deletions

View File

@ -19,8 +19,13 @@ public class SOPExecutionExceptionHandler implements CommandLine.IExecutionExcep
// CHECKSTYLE:OFF
if (ex.getMessage() != null) {
commandLine.getErr().println(colorScheme.errorText(ex.getMessage()));
} else {
commandLine.getErr().println(ex.getClass().getName());
}
if (SopCLI.stacktrace) {
ex.printStackTrace(commandLine.getErr());
}
ex.printStackTrace(commandLine.getErr());
// CHECKSTYLE:ON
return exitCode;

View File

@ -52,6 +52,10 @@ public class SopCLI {
public static String EXECUTABLE_NAME = "sop";
@CommandLine.Option(names = {"--stacktrace"}, description = "Print Stacktrace",
scope = CommandLine.ScopeType.INHERIT)
static boolean stacktrace;
public static void main(String[] args) {
int exitCode = execute(args);
if (exitCode != 0) {