@@ -0,0 +1,2773 @@
+package picocli;%0A%0Aimport org.junit.Rule;%0Aimport org.junit.Test;%0Aimport org.junit.contrib.java.lang.system.ProvideSystemProperty;%0Aimport org.junit.contrib.java.lang.system.RestoreSystemProperties;%0Aimport org.junit.contrib.java.lang.system.SystemErrRule;%0Aimport org.junit.rules.TestRule;%0Aimport picocli.CommandLine.IParameterExceptionHandler;%0Aimport picocli.CommandLine.Option;%0Aimport picocli.CommandLine.ParameterException;%0A%0Aimport java.io.PrintWriter;%0A%0Aimport static org.junit.Assert.*;%0A%0Apublic class Issue1565HideParamOnUnknownOption %7B%0A%0A    @Rule%0A    public final TestRule restoreSystemProperties = new RestoreSystemProperties();%0A%0A    @Rule%0A    public final SystemErrRule systemErrRule = new SystemErrRule().enableLog();%0A%0A    @Rule%0A    public final ProvideSystemProperty ansiOFF = new ProvideSystemProperty(%22picocli.ansi%22, %22false%22);%0A%0A    static class Issue1565 %7B%0A        @Option(names = %22--option%22) String option;%0A    %7D%0A%0A    @Test%0A    public void testIssue1565() %7B%0A        CommandLine cmd = new CommandLine(new Issue1565());%0A        cmd.setParameterExceptionHandler(new IParameterExceptionHandler() %7B%0A            public int handleParseException(ParameterException ex, String%5B%5D args) throws Exception %7B%0A                CommandLine cmd = ex.getCommandLine();%0A                PrintWriter writer = cmd.getErr();%0A                CommandLine.Help.ColorScheme colorScheme = cmd.getColorScheme();%0A                String errorMessage = ex.getMessage();%0A                int equalsPosition = errorMessage.indexOf(%22=%22);%0A                if (equalsPosition %3E= 1 && errorMessage.endsWith(%22'%22)) %7B%0A                    errorMessage = errorMessage.substring(0, equalsPosition) + %22'%22;%0A                %7D%0A                writer.println(colorScheme.errorText(errorMessage));%0A                if (!CommandLine.UnmatchedArgumentException.printSuggestions(ex, writer)) %7B%0A                    ex.getCommandLine().usage(writer, colorScheme);%0A                %7D%0A                return mappedExitCode(ex, cmd.getExitCodeExceptionMapper(), cmd.getCommandSpec().exitCodeOnInvalidInput());%0A            %7D%0A            private int mappedExitCode(Throwable t, CommandLine.IExitCodeExceptionMapper mapper, int defaultExitCode) %7B%0A                try %7B%0A                    return (mapper != null) ? mapper.getExitCode(t) : defaultExitCode;%0A                %7D catch (Exception ex) %7B%0A                    ex.printStackTrace();%0A                    return defaultExitCode;%0A                %7D%0A            %7D%0A        %7D);%0A        cmd.execute(%22--aption=SENSITIVE_VALUE%22);%0A%0A        String expected = String.format(%22%22 +%0A            %22Unknown option: '--aption'%25n%22 +%0A            %22Usage: %3Cmain class%3E %5B--option=%3Coption%3E%5D%25n%22 +%0A            %22      --option=%3Coption%3E%25n%22);%0A        assertEquals(expected, systemErrRule.getLog());%0A    %7D%0A%7D%0A

add test demonstrating IParameterExceptionHandler changing error message