Java Code Examples for org.fusesource.jansi.Ansi#ansi()
The following examples show how to use
org.fusesource.jansi.Ansi#ansi() .
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: AnsiLoggerFacadeTest.java From jkube with Eclipse Public License 2.0 | 6 votes |
@Test public void emphasize() { TestLog testLog = new TestLog(); AnsiLoggerFacade logger = new AnsiLoggerFacade(testLog, true, false, false, "T>"); Ansi ansi = Ansi.ansi(); logger.info("Yet another [[*]]Test[[*]] %s","emphasis"); assertEquals(ansi.a("T>") .fg(AnsiLoggerFacade.COLOR_INFO) .a("Yet another ") .fgBright(AnsiLoggerFacade.COLOR_EMPHASIS) .a("Test") .fg(AnsiLoggerFacade.COLOR_INFO) .a(" emphasis") .reset().toString(), testLog.getMessage()); }
Example 2
Source File: AnsiLoggerTest.java From jkube with Eclipse Public License 2.0 | 6 votes |
@Test public void emphasizeInfo() { TestLog testLog = new TestLog(); AnsiLogger logger = new AnsiLogger(testLog, true, null, false, "T>"); Ansi ansi = Ansi.ansi(); logger.info("Yet another [[*]]Test[[*]] %s", "emphasis"); assertEquals(ansi.fg(AnsiLogger.INFO) .a("T>") .a("Yet another ") .fgBright(AnsiLogger.EMPHASIS) .a("Test") .fg(AnsiLogger.INFO) .a(" emphasis") .reset().toString(), testLog.getMessage()); }
Example 3
Source File: AnsiLoggerTest.java From docker-maven-plugin with Apache License 2.0 | 6 votes |
@Test public void emphasizeInfo() { TestLog testLog = new TestLog(); AnsiLogger logger = new AnsiLogger(testLog, true, "build", false, "T>"); Ansi ansi = Ansi.ansi(); logger.info("Yet another [[*]]Test[[*]] %s", "emphasis"); assertEquals(ansi.fg(AnsiLogger.COLOR_INFO) .a("T>") .a("Yet another ") .fgBright(AnsiLogger.COLOR_EMPHASIS) .a("Test") .fg(AnsiLogger.COLOR_INFO) .a(" emphasis") .reset().toString(), testLog.getMessage()); }
Example 4
Source File: TreePrinter.java From seed with Mozilla Public License 2.0 | 6 votes |
void printTree(PrintStream stream) { Ansi ansi = Ansi.ansi(); ansi .a("Configuration options") .newline() .a("---------------------") .newline(); printTree(node, "", ansi); ansi .newline() .a("(*) mandatory property") .newline() .a("(~) default property (can be specified as single value)") .newline(); stream.print(ansi.toString()); }
Example 5
Source File: VisageFormatter.java From Visage with MIT License | 5 votes |
@Override public String format(LogRecord record) { if (record.getThrown() != null) { record.getThrown().printStackTrace(); } Ansi ansi = Ansi.ansi(); if (Visage.ansi) { ansi.fgBright(Color.BLACK); } Date date = new Date(record.getMillis()); ansi.a("@"); ansi.a(format.format(date)); if (Visage.ansi) { ansi.reset(); } ansi.a(Strings.padStart(Thread.currentThread().getName(), 22, ' ')); ansi.a(" "); if (Visage.ansi && colors.containsKey(record.getLevel())) { ansi.fgBright(colors.get(record.getLevel())); } ansi.a(names.get(record.getLevel())); if (Visage.ansi) { ansi.reset(); } ansi.a(": "); if (Visage.ansi && colors.containsKey(record.getLevel()) && record.getLevel().intValue() >= Level.SEVERE.intValue()) { ansi.bold(); ansi.fgBright(colors.get(record.getLevel())); } ansi.a(record.getMessage()); if (Visage.ansi) { ansi.reset(); } ansi.a("\n"); return ansi.toString(); }
Example 6
Source File: GruntParser.java From spork with Apache License 2.0 | 5 votes |
@Override protected void printClear() { AnsiConsole.systemInstall(); Ansi ansi = Ansi.ansi(); System.out.println( ansi.eraseScreen() ); System.out.println( ansi.cursor(0, 0) ); AnsiConsole.systemUninstall(); }
Example 7
Source File: DetailPrinter.java From seed with Mozilla Public License 2.0 | 5 votes |
void printDetail(PrintStream stream) { Ansi ansi = Ansi.ansi(); String title = "Details of " + propertyInfo.getName(); ansi .a(title) .newline() .a(Strings.repeat("-", title.length())) .newline().newline(); printSummary(propertyInfo, ansi); printDeclaration(propertyInfo, ansi); printLongDescription(propertyInfo, ansi); printAdditionalInfo(propertyInfo, ansi); ansi.newline(); stream.print(ansi.toString()); }
Example 8
Source File: JAnsiTextRenderer.java From logging-log4j2 with Apache License 2.0 | 5 votes |
/** * Renders the given text with the given names which can be ANSI code names or Log4j style names. * * @param text * The text to render * @param names * ANSI code names or Log4j style names. * @return A rendered string containing ANSI codes. */ private String render(final String text, final String... names) { final Ansi ansi = Ansi.ansi(); for (final String name : names) { final Code[] codes = styleMap.get(name); if (codes != null) { render(ansi, codes); } else { render(ansi, toCode(name)); } } return ansi.a(text).reset().toString(); }
Example 9
Source File: AnsiConsole.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
Ansi createAnsi() { return Ansi.ansi(); }
Example 10
Source File: AnsiConsole.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
Ansi createAnsi() { return Ansi.ansi(); }
Example 11
Source File: WordNetToStringBuilder.java From mynlp with Apache License 2.0 | 4 votes |
@Override public String toString() { BitSet noover = this.wordnet.findNoOverWords(); StringBuilder sb = new StringBuilder(); char[] text = wordnet.getCharArray(); for (int i = -1; i <= wordnet.getCharSizeLength(); i++) { StringBuilder line = new StringBuilder(); VertexRow row = wordnet.row(i); char char_ = 0; if (i >= 0 && i < text.length) { char_ = text[i]; } else { if (i == -1) { char_ = '¤'; } else { char_ = '¶'; } } line.append(String.format("@|cyan %d|@\t@|green %c |@", i, char_)); line.append("\t@|yellow ||@\t"); if (row.isEmpty()) { if (noover.get(i)) { line.append("\t@|green NULL|@"); } else { line.append("\t@|red NULL|@"); } } else { if (i == -1) { line.append("\t@|green BEGIN|@"); } else if (i >= text.length) { line.append("\t@|green END|@"); } else { int count = 0; for (Vertex v : row) { line.append("\t"); if (count > 0) { line.append("\t"); } // 原始词 line.append(text, i, v.length); if (v.isAbsWord()) { // 等效词 line.append("[").append(v.absWordLabel()).append("]"); } if (showAttr && v.nature != null) { line.append(" ").append(v.nature); } if (v.weight != 0) { line.append("(").append(v.weight).append(")"); } //line.append(" From[" + v.from + "]"); count++; } } } sb.append(line).append("\n"); } try { Ansi ansi = Ansi.ansi(); return ansi.eraseScreen().render(sb.toString()).toString(); } catch (Throwable e) { //@|green BEGIN|@ //@|cyan 12|@ @|green ¶ |@ @|yellow ||@ @|green END|@ return sb.toString().replaceAll("@\\|\\w+? (.+?)\\|@", "$1"); } }
Example 12
Source File: ConsoleWriter.java From mojito with Apache License 2.0 | 4 votes |
/** * Reset both output builders. */ private void resetOutputBuilders() { ansi = Ansi.ansi(); stringBuilder = new StringBuilder(); }
Example 13
Source File: AnsiConsole.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
Ansi createAnsi() { return Ansi.ansi(); }
Example 14
Source File: AnsiConsole.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
Ansi createAnsi() { return Ansi.ansi(); }
Example 15
Source File: CustomColorization.java From maven-color with MIT License | 4 votes |
protected final Ansi ansi() { return Ansi.ansi(); }