private void printException(Throwable e, boolean stacktrace) {
        try (ColorBuffer buffer = ColorBuffer.of(colorFormatter, stderrPrinter)) {
            if (!stacktrace) {
                colorFormatter.println(stderrPrinter, e.getMessage(), ColorTheme.ERROR);
            } else {
                StringWriter writer = new StringWriter();
                e.printStackTrace(new PrintWriter(writer));
                String result = writer.toString();
                int positionOfName = result.indexOf(':');
                buffer.print(result.substring(0, positionOfName), ColorTheme.ERROR);
                buffer.println(result.substring(positionOfName));
            }
        }
    }
Execute the command line using the given arguments.

@param args Arguments to parse.
@return Returns the exit code.
@throws CliError on error.
smithy-cli/src/main/java/software/amazon/smithy/cli/Cli.java