Java Code Examples for org.aesh.readline.terminal.Key#findStartKey()
The following examples show how to use
org.aesh.readline.terminal.Key#findStartKey() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UpdateCommand.java From galleon with Apache License 2.0 | 5 votes |
@Override protected void doRunCommand(PmCommandInvocation session, Map<String, String> options) throws CommandExecutionException { try { ProvisioningManager mgr = getManager(session); Updates updates = CheckUpdatesCommand.getUpdatesTable(mgr, session, allDependencies(), getFP()); if (updates.plan.isEmpty()) { session.println(UP_TO_DATE); } else { session.println(UPDATES_AVAILABLE); session.println(updates.t.build()); if (!noConfirm()) { try { Key k = null; while (k == null || (!Key.y.equals(k) && !Key.n.equals(k))) { session.print("Proceed with latest updates [y/n]?"); KeyAction a = session.input(); k = Key.findStartKey(a.buffer().array()); } if (Key.n.equals(k)) { return; } } finally { session.println(""); } } mgr.apply(updates.plan, options); } } catch (ProvisioningException | IOException ex) { throw new CommandExecutionException(session.getPmSession(), CliErrors.updateFailed(), ex); } catch (InterruptedException ignored) { // Just exit the command smoothly } }
Example 2
Source File: CLICommandInvocationBuilder.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override public Key read() throws InterruptedException { try { return Key.findStartKey(ctx.input()); } catch (CommandLineException | IOException ex) { throw new RuntimeException(ex); } }
Example 3
Source File: ReadlineConsole.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
public Key readKey() throws InterruptedException, IOException { return Key.findStartKey(read()); }