-
Notifications
You must be signed in to change notification settings - Fork 446
Closed
Milestone
Description
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();