@Override public void run(Application app, CommandLine cmdLine) throws Exception { boolean state = Console.getDefault().isPrintTimeStamps() ? false : true; // Toggle time state Console.getDefault().setPrintTimeStamps(state); if (state) println("Timestamps on"); else println("Timestamps off"); }
@Override public void start(Application app) throws IOException { super.start(app); updatePrompt(); // register completors console.addCompleter(new CompositeCompletor(this, app.getCommandRegistry())); String line = console.readLine(); while (line != null) { line = line.trim(); try { if (line.length() > 0) { if (!execute(line)) { break; } // println(); } } catch (Exception e) { e.printStackTrace(); } line = console.readLine(); } console.print("Bye"); console.println(); }