本文整理汇总了Java中org.fusesource.jansi.Ansi.ansi方法的典型用法代码示例。如果您正苦于以下问题:Java Ansi.ansi方法的具体用法?Java Ansi.ansi怎么用?Java Ansi.ansi使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.fusesource.jansi.Ansi
的用法示例。
在下文中一共展示了Ansi.ansi方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: translate
import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
public static String translate(Object... elements) {
Ansi ansi = Ansi.ansi();
for (Object element : elements) {
if (element instanceof Ansi.Color) {
ansi.fg((Ansi.Color) element);
continue;
}
else if (element == RESET) {
ansi.reset();
continue;
}
ansi.a(element);
ansi.a(" ");
}
return ansi.toString();
}
示例2: createAnsi
import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
Ansi createAnsi() {
if (forceAnsi) {
return new Ansi();
} else {
return Ansi.ansi();
}
}
示例3: clear
import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
public static Ansi clear(final Map2D<TerminalPixel> image) {
Preconditions.checkNotNull(image);
final Ansi ansi = Ansi.ansi();
for (int y = 0; y < image.height(); y++) {
ansi.eraseLine(Ansi.Erase.ALL)
.cursorToColumn(0)
.cursorUpLine();
}
return ansi;
}
示例4: append
import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
/**
* Append text with the given ANSI codes.
* @param text the text to append
* @param codes the ANSI codes
* @return this string
*/
AnsiString append(String text, Code... codes) {
if (codes.length == 0 || !isAnsiSupported()) {
this.value.append(text);
return this;
}
Ansi ansi = Ansi.ansi();
for (Code code : codes) {
ansi = applyCode(ansi, code);
}
this.value.append(ansi.a(text).reset().toString());
return this;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:19,代码来源:AnsiString.java
示例5: format
import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
@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();
}
示例6: renderErrorLocation
import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
private static void renderErrorLocation(String query, ErrorLocation location, PrintStream out)
{
List<String> lines = ImmutableList.copyOf(Splitter.on('\n').split(query).iterator());
String errorLine = lines.get(location.getLineNumber() - 1);
String good = errorLine.substring(0, location.getColumnNumber() - 1);
String bad = errorLine.substring(location.getColumnNumber() - 1);
if ((location.getLineNumber() == lines.size()) && bad.trim().isEmpty()) {
bad = " <EOF>";
}
if (REAL_TERMINAL) {
Ansi ansi = Ansi.ansi();
ansi.fg(Ansi.Color.CYAN);
for (int i = 1; i < location.getLineNumber(); i++) {
ansi.a(lines.get(i - 1)).newline();
}
ansi.a(good);
ansi.fg(Ansi.Color.RED);
ansi.a(bad).newline();
for (int i = location.getLineNumber(); i < lines.size(); i++) {
ansi.a(lines.get(i)).newline();
}
ansi.reset();
out.print(ansi);
}
else {
String prefix = format("LINE %s: ", location.getLineNumber());
String padding = Strings.repeat(" ", prefix.length() + (location.getColumnNumber() - 1));
out.println(prefix + errorLine);
out.println(padding + "^");
}
}
示例7: printClear
import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
@Override
protected void printClear() {
AnsiConsole.systemInstall();
Ansi ansi = Ansi.ansi();
System.out.println( ansi.eraseScreen() );
System.out.println( ansi.cursor(0, 0) );
AnsiConsole.systemUninstall();
}
示例8: render
import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
/**
* 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();
}
示例9: AnsiPrintToolkit
import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
public AnsiPrintToolkit() {
this(Ansi.ansi());
}
示例10: resetOutputBuilders
import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
/**
* Reset both output builders.
*/
private void resetOutputBuilders() {
ansi = Ansi.ansi();
stringBuilder = new StringBuilder();
}
示例11: createAnsi
import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
Ansi createAnsi() {
return Ansi.ansi();
}
示例12: ansi
import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
protected final Ansi ansi() {
return Ansi.ansi();
}
示例13: execute
import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
@Override
public Object execute() throws Exception {
Ansi buffer = Ansi.ansi();
boolean found = false;
for (Factory factory : managerService.getFactories()) {
if (name.equals(factory.getName())) {
printFactoryDetails(buffer, factory);
found = true;
}
}
PrintStream stream = System.out;
if (!found) {
// Use error stream
stream = System.err;
// Creates an error message
buffer.a(" [");
buffer.a(Ansi.Color.RED);
buffer.a("ERROR");
buffer.reset();
buffer.a("] ");
buffer.a("Factory '");
buffer.a(Ansi.Attribute.ITALIC);
buffer.a(name);
buffer.a(Ansi.Attribute.ITALIC_OFF);
buffer.a("' was not found.\n");
}
// Flush buffer's content
stream.println(buffer.toString());
return null;
}