@Override public synchronized void flush() { try { if (jline) { reader.print(ConsoleReader.RESET_LINE + ""); reader.flush(); super.flush(); try { reader.drawLine(); } catch (Throwable ex) { reader.getCursorBuffer().clear(); } reader.flush(); } else { super.flush(); } } catch (IOException ex) { logger.log(Level.SEVERE, "I/O exception flushing console output", ex); } } }
/** * Issue an audible keyboard bell. */ public void beep() throws IOException { if (bellEnabled) { if (tputs("bell")) { // need to flush so the console actually beeps flush(); } } }
private void logError(String s) { log.error(s); if (logErrorsToConsole) { try { reader.println("ERROR: " + s); reader.flush(); } catch (IOException e) {} } }
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { // only method we are proxying is handle() terminal.init(); try { drawLine(); flush(); } catch (IOException e) { e.printStackTrace(); } return null; } });
/** * The equivalent of hitting <RET>. The line is considered * complete and is returned. * * @return The completed line of text. */ public String accept() throws IOException { moveToEnd(); println(); // output newline flush(); return finishBuffer(); }
@Override public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception { boolean force = false; boolean operate = true; if (cl.hasOption(forceOpt.getOpt())) { force = true; } String namespace = cl.getArgs()[0]; if (!force) { shellState.getReader().flush(); String line = shellState.getReader() .readLine(getName() + " { " + namespace + " } (yes|no)? "); operate = line != null && (line.equalsIgnoreCase("y") || line.equalsIgnoreCase("yes")); } if (operate) { doTableOp(shellState, namespace, force); } return 0; }
@Override public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws IOException { // custom clear screen, so I don't have to redraw the prompt twice if (!shellState.getReader().getTerminal().isAnsiSupported()) { throw new IOException("Terminal does not support ANSI commands"); } // send the ANSI code to clear the screen shellState.getReader().print(((char) 27) + "[2J"); shellState.getReader().flush(); // then send the ANSI code to go to position 1,1 shellState.getReader().print(((char) 27) + "[1;1H"); shellState.getReader().flush(); return 0; }
reader.flush();
flush(); return true;
private void doDropUser(final Shell shellState, final String user, final boolean force) throws AccumuloException, AccumuloSecurityException { boolean operate = true; try { if (!force) { shellState.getReader().flush(); String line = shellState.getReader().readLine(getName() + " { " + user + " } (yes|no)? "); operate = line != null && (line.equalsIgnoreCase("y") || line.equalsIgnoreCase("yes")); } if (operate) { shellState.getAccumuloClient().securityOperations().dropLocalUser(user); Shell.log.debug("Deleted user " + user); } } catch (IOException e) { throw new AccumuloException(e); } }
shellState.getReader().flush(); String line = shellState.getReader() .readLine(getName() + " { " + tableName + " } (yes|no)? ");
public void printInfo() throws IOException { ClientInfo info = ClientInfo.from(accumuloClient.properties()); reader.print("\n" + SHELL_DESCRIPTION + "\n" + "- \n" + "- version: " + Constants.VERSION + "\n" + "- instance name: " + info.getInstanceName() + "\n" + "- instance id: " + accumuloClient.getInstanceID() + "\n" + "- \n" + "- type 'help' for a list of available commands\n" + "- \n"); reader.flush(); }
shellState.getReader().flush(); String line = shellState.getReader() .readLine("Merge the entire table { " + tableName + " } into one tablet (yes|no)? ");
setCursorPosition(cursorDest); flush();
lastPromptLength = nextPrompt.length(); reader.print(nextPrompt); reader.flush();
public void print(String s) { for ( ChatColor color : colors ) { s = s.replaceAll( "(?i)" + color.toString(), replacements.get( color ) ); } try { console.print( Ansi.ansi().eraseLine( Erase.ALL ).toString() + ConsoleReader.RESET_LINE + s + Ansi.ansi().reset().toString() ); console.drawLine(); console.flush(); } catch ( IOException ex ) { } }
flush(); int c = readCharacter(); if (c == '\r' || c == '\n') {
private void insertClose(String s) throws IOException { putString(s); int closePosition = buf.cursor; moveCursor(-1); viMatch(); if (in.isNonBlockingEnabled()) { in.peek(parenBlinkTimeout); } setCursorPosition(closePosition); flush(); }
/** * Possible states in which the current readline operation may be in. */ private static enum State { /** * The user is just typing away */ NORMAL, /** * In the middle of a emacs seach */ SEARCH, FORWARD_SEARCH, /** * VI "yank-to" operation ("y" during move mode) */ VI_YANK_TO, /** * VI "delete-to" operation ("d" during move mode) */ VI_DELETE_TO, /** * VI "change-to" operation ("c" during move mode) */ VI_CHANGE_TO }
try { if (!force) { shellState.getReader().flush(); String line = shellState.getReader().readLine("Delete { " + entryStr + " } ? "); more = line != null;