Refine search
/** * 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++; }
private void log(final String level, Object msg, Throwable cause) { assert level != null; assert msg != null; if (io == null) { synchronized (Logger.class) { if (io == null) { io = new IO(); } } } // Allow the msg to be a Throwable, and handle it properly if no cause is given if (cause == null) { if (msg instanceof Throwable) { cause = (Throwable) msg; msg = cause.getMessage(); } } Color color = GREEN; if (WARN.equals(level) || ERROR.equals(level)) { color = RED; } io.out.println(ansi().a(INTENSITY_BOLD).fg(color).a(level).reset().a(" [").a(name).a("] ").a(msg)); if (cause != null) { cause.printStackTrace(io.out); } io.flush(); }
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; } }
@Override public void print(RevCommit commit) throws IOException { Ansi ansi = newAnsi(console); ansi.fg(Color.YELLOW).a(getIdAsString(commit.getId())).reset(); String message = Strings.nullToEmpty(commit.getMessage()); String title = Splitter.on('\n').split(message).iterator().next(); ansi.a(" ").a(title); console.println(ansi.toString()); }
@Override public void print(RevCommit commit) throws IOException { Ansi ansi = newAnsi(console); ansi.fg(Color.YELLOW).a(getIdAsString(commit.getId())).reset(); String message = Strings.nullToEmpty(commit.getMessage()); String title = Splitter.on('\n').split(message).iterator().next(); ansi.a(" ").a(title); console.println(ansi.toString()); }
private void printFeatureType(Ansi ansi, RevFeatureType ft, boolean useDefaultKeyword) { ImmutableList<PropertyDescriptor> attribs = ft.descriptors(); ansi.fg(Color.YELLOW).a(useDefaultKeyword ? "DEFAULT " : "").a("FEATURE TYPE ID: ").reset() .a(ft.getId().toString()).newline().newline(); ansi.a(useDefaultKeyword ? "DEFAULT " : "").a("FEATURE TYPE ATTRIBUTES").newline(); for (PropertyDescriptor attrib : attribs) { ansi.fg(Color.YELLOW).a(attrib.getName() + ": ").reset() .a("<" + FieldType.forBinding(attrib.getType().getBinding()) + ">").newline(); } }