You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the error message generated by this handler is rendered in the default console style.
The default handler uses bold red, which is nice.
Show users how to do this in the custom handler.
Index: docs/index.adoc
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- docs/index.adoc (date 1594795931082)
+++ docs/index.adoc (date 1594795931082)
@@ -2251,13 +2251,17 @@
CommandLine cmd = ex.getCommandLine();
PrintWriter writer = cmd.getErr();
- writer.println(ex.getMessage());
+ writer.println(cmd.getColorScheme().errorText(ex.getMessage())); // error message in bold red
UnmatchedArgumentException.printSuggestions(ex, writer);
writer.print(cmd.getHelp().fullSynopsis()); // since 4.1
CommandSpec spec = cmd.getCommandSpec();
writer.printf("Try '%s --help' for more information.%n", spec.qualifiedName());
+ if ("DEBUG".equalsIgnoreCase(System.getProperty("picocli.trace"))) {
+ ex.printStackTrace(System.err); // provide more details if requested
+ }
+
return cmd.getExitCodeExceptionMapper() != null
? cmd.getExitCodeExceptionMapper().getExitCode(ex)
: spec.exitCodeOnInvalidInput();
The text was updated successfully, but these errors were encountered:
print stack trace to cmd.getErr instead of to System.err
print stack trace after DEBUG trace messages and before the red bold error message/usage message
apply stacktrace style to stack trace
PrintWriter err = cmd.getErr();
// if we are tracing at DEBUG level, print a stacktrace
if ("DEBUG".equalsIgnoreCase(System.getProperty("picocli.trace"))) {
StringWriter sw = new StringWriter();
ex.printStackTrace(new PrintWriter(sw, true));
err.print(cmd.getColorScheme().stackTraceText(sw.toString()));
}
err.println(cmd.getColorScheme().errorText(ex.getMessage())); // bold red
UnmatchedArgumentException.printSuggestions(ex, err);
err.print(cmd.getHelp().fullSynopsis());
CommandSpec spec = cmd.getCommandSpec();
err.printf("Try '%s --help' for more information.%n", spec.qualifiedName());
Currently, the error message generated by this handler is rendered in the default console style.
The default handler uses bold red, which is nice.
Show users how to do this in the custom handler.
The text was updated successfully, but these errors were encountered: