/** Launches the console mode, which reads and executes user input. */ private void console() { Util.outln(header() + NL + TRY_MORE_X); verbose = true; // create console reader try (final ConsoleReader cr = ConsoleReader.get()) { // loop until console is set to false (may happen in server mode) while (console) { // get next line final String in = cr.readLine(PROMPT); // end of input: break loop if (in == null) break; // skip empty lines if (in.isEmpty()) continue; try { if (!execute(new CommandParser(in, context).pwReader(cr.pwReader()))) { // show goodbye message if method returns false Util.outln(BYE[new Random().nextInt(4)]); break; } } catch (final IOException ex) { // output error messages Util.errln(ex); } } } }