[ide-console][cli-repl] Decorations for smooth console view

Icons on history commands
Linebreaks between `command-result` blocks
Exceptions stacktrace and icons
Bold invitation
This commit is contained in:
Dmitry Kovanikov
2015-08-27 19:41:54 +03:00
committed by Pavel V. Talanov
parent 3271fae7ac
commit 058b539004
10 changed files with 112 additions and 63 deletions
@@ -218,11 +218,12 @@ public class ReplFromTerminal {
private boolean oneCommand(@NotNull String command) throws Exception {
List<String> split = splitCommand(command);
if (split.size() >= 1 && command.equals("help")) {
replWriter.println("Available commands:");
replWriter.println(":help show this help");
replWriter.println(":quit exit the interpreter");
replWriter.println(":dump bytecode dump classes to terminal");
replWriter.println(":load <file> load script from specified file");
replWriter.printlnHelp("Available commands:\n" +
":help show this help\n" +
":quit exit the interpreter\n" +
":dump bytecode dump classes to terminal\n" +
":load <file> load script from specified file"
);
return true;
}
else if (split.size() >= 2 && split.get(0).equals("dump") && split.get(1).equals("bytecode")) {
@@ -239,8 +240,9 @@ public class ReplFromTerminal {
return true;
}
else {
replWriter.println("Unknown command");
replWriter.println("Type :help for help");
replWriter.printlnHelp("Unknown command\n" +
"Type :help for help"
);
return true;
}
}
@@ -25,6 +25,7 @@ public class ReplSystemOutWrapper(private val standardOut: PrintStream, private
private enum class EscapeType {
INITIAL_PROMPT,
HELP_PROMPT,
USER_OUTPUT,
REPL_RESULT,
REPL_INCOMPLETE,
@@ -57,6 +58,7 @@ public class ReplSystemOutWrapper(private val standardOut: PrintStream, private
}
fun printlnInit(x: String) = printlnWithEscaping(x, EscapeType.INITIAL_PROMPT)
fun printlnHelp(x: String) = printlnWithEscaping(x, EscapeType.HELP_PROMPT)
fun printlnResult(x: Any?) = printlnWithEscaping(x.toString(), EscapeType.REPL_RESULT)
fun printlnIncomplete() = printlnWithEscaping("", EscapeType.REPL_INCOMPLETE)
fun printlnCompileError(x: String) = printlnWithEscaping(x, EscapeType.COMPILE_ERROR)