/** * Replays the last status message. */ public void echoStatus() { if (lastStatus != null) { updateStatus(lastStatus.toString()); } }
public void repositionCursor() { if (lines > 0) { if (isRealTerminal()) { out.print(ansi().cursorUp(lines).toString()); } else { out.print('\r'); } out.flush(); lines = 0; } }
/** * NOTE: Use this method only if isUnixTerminal is true. * Repositions the cursor back to line 0. */ private void repositionCursor() { if (lines > 0) { out.print(ansi().cursorUp(lines).toString()); out.flush(); lines = 0; } }
public static void rePositionCursor(PrintStream ps) { ps.print(ansi().cursorUp(0).toString()); ps.flush(); }
public void resetScreen() { if (lines > 0) { if (isRealTerminal()) { out.print(ansi().cursorUp(lines).eraseScreen(Erase.FORWARD).toString()); } else { out.print('\r'); } out.flush(); lines = 0; } }
private void repositionCursor() { if (lines > 0) { out.print(ansi().cursorUp(lines).toString()); out.flush(); lines = 0; } }
public void reprintLine(String line) { if (isRealTerminal()) { out.print(ansi().eraseLine(Erase.ALL).a(line).a('\n').toString()); } else { out.print('\r' + line); } out.flush(); lines++; }
/** * Makes sure that the console has been reset to the default state and that the out stream has been flushed. */ public void flush() { if (isAnsiEnabled()) { out.print(ansi().reset().toString()); } out.flush(); }
/** * NOTE: Use this method only if isUnixTerminal is true. * Erases the current line and prints the given multiline. Make sure the specified line is not * terminated by linebreak. * * @param line - line to print */ private void reprintMultiLine(String line) { int numLines = line.split("\r\n|\r|\n").length; out.print(ansi().eraseLine(Ansi.Erase.ALL).a(line).a('\n').toString()); out.flush(); lines += numLines; }
private void reprintMultiLine(String line) { int numLines = line.split("\r\n|\r|\n").length; out.print(ansi().eraseLine(Ansi.Erase.ALL).a(line).a('\n').toString()); out.flush(); lines += numLines; } }
public static void reprintLine(PrintStream out, String line) { out.print(ansi().eraseLine(Ansi.Erase.ALL).a(line).a('\n').toString()); out.flush(); }
/** * Finis progress meter. Must be always called if {@link #progressStart()} has been used. */ public void progressFinished() { if (!batchMode && log.isInfoEnabled()) { imageLines.remove(); print(ansi().reset().toString()); if (!useAnsi) { println(""); } } }
/** * Shows the prompt to request user input. * * @return The user input prompt */ public String showPrompt() { String prompt = isAnsiEnabled() ? ansiPrompt(PROMPT).toString() : PROMPT; return showPrompt(prompt); }
private String formatTimestamp(Timestamp timestamp,boolean withColor) { if (timeFormatter == null) { return ""; } String date = timeFormatter.print(timestamp.getDate()); return (withColor ? ansi().fgBright(BLACK).a(date).reset().toString() : date) + " "; }
private String doUserInput(String msg, boolean secure) { // Add a space to the end of the message if there isn't one already. if (!msg.endsWith(" ") && !msg.endsWith("\t")) { msg += ' '; } lastMessage = ""; msg = isAnsiEnabled() ? outputCategory(ansi(), ">").fg(DEFAULT).a(msg).reset().toString() : msg; try { return readLine(msg, secure); } finally { cursorMove = 0; } }
/** * NOTE: Use this method only if isUnixTerminal is true. * Erases the current line and prints the given line with the specified color. * * @param line - line to print * @param color - color for the line */ private void reprintLineWithColorAsBold(String line, Ansi.Color color) { out.print(ansi().eraseLine(Ansi.Erase.ALL).fg(color).bold().a(line).a('\n').boldOff().reset() .toString()); out.flush(); lines++; }
/** {@inheritDoc} */ public void verbose(String message, Object ... params) { if (verbose) { log.info(ansi().fgBright(BLACK).a(prefix).a(format(message, params)).reset().toString()); } }
private void reprintLineWithColorAsBold(String line, Ansi.Color color) { out.print(ansi().eraseLine(Ansi.Erase.ALL).fg(color).bold().a(line).a('\n').boldOff().reset() .toString()); out.flush(); lines++; }
private String colored(String message, Ansi.Color color, boolean addPrefix, Object ... params) { Ansi ansi = ansi().fg(color); String msgToPrint = addPrefix ? prefix + message : message; return ansi.a(format(evaluateEmphasis(msgToPrint, color), params)).reset().toString(); }