org.fusesource.jansi.Ansi.a()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(126)

本文整理了Java中org.fusesource.jansi.Ansi.a()方法的一些代码示例,展示了Ansi.a()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ansi.a()方法的具体详情如下:
包路径:org.fusesource.jansi.Ansi
类名称:Ansi
方法名:a

Ansi.a介绍

暂无

代码示例

代码示例来源:origin: micronaut-projects/micronaut-core

private Ansi ansiPrompt(String prompt) {
  return ansi()
    .a(Ansi.Attribute.INTENSITY_BOLD)
    .fgBright(BLUE)
    .a(prompt)
    .a(Ansi.Attribute.INTENSITY_BOLD_OFF)
    .fg(DEFAULT);
}

代码示例来源:origin: fabric8io/docker-maven-plugin

/** {@inheritDoc} */
public void verbose(String message, Object ... params) {
  if (verbose) {
    log.info(ansi().fgBright(BLACK).a(prefix).a(format(message, params)).reset().toString());
  }
}

代码示例来源:origin: org.apache.maven.shared/maven-shared-utils

public AnsiMessageBuilder success( Object message )
{
  Style.SUCCESS.apply( ansi ).a( message ).reset();
  return this;
}

代码示例来源:origin: org.codehaus.groovy/groovy

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();
}

代码示例来源:origin: prestodb/presto

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++;
}

代码示例来源:origin: org.apache.maven.shared/maven-shared-utils

public AnsiMessageBuilder strong( Object message )
{
  Style.STRONG.apply( ansi ).a( message ).reset();
  return this;
}

代码示例来源:origin: apache/hive

/**
 * 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++;
}

代码示例来源:origin: apache/hive

public static void reprintLine(PrintStream out, String line) {
 out.print(ansi().eraseLine(Ansi.Erase.ALL).a(line).a('\n').toString());
 out.flush();
}

代码示例来源:origin: org.apache.maven.shared/maven-shared-utils

public AnsiMessageBuilder mojo( Object message )
{
  Style.MOJO.apply( ansi ).a( message ).reset();
  return this;
}

代码示例来源:origin: fabric8io/docker-maven-plugin

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) + " ";
}

代码示例来源:origin: apache/hive

/**
 * 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;
}

代码示例来源:origin: org.apache.maven.shared/maven-shared-utils

public AnsiMessageBuilder project( Object message )
{
  Style.PROJECT.apply( ansi ).a( message ).reset();
  return this;
}

代码示例来源:origin: apache/drill

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++;
}

代码示例来源:origin: apache/drill

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;
 }
}

代码示例来源:origin: org.apache.maven.plugins/maven-surefire-report-plugin

public AnsiMessageBuilder failure( Object message )
{
  Style.FAILURE.apply( ansi ).a( message ).reset();
  return this;
}

代码示例来源:origin: fabric8io/docker-maven-plugin

private String formatPrefix(String prefix,boolean withColor) {
  if (withColor) {
    Ansi ansi = ansi();
    if (fgBright) {
      ansi.fgBright(color);
    } else {
      ansi.fg(color);
    }
    return ansi.a(prefix).reset().toString();
  } else {
    return prefix;
  }
}

代码示例来源:origin: GlowstoneMC/Glowstone

Ansi.ansi().a(Attribute.RESET).fg(Color.BLACK).boldOff().toString());
replacements.put(ChatColor.DARK_BLUE,
  Ansi.ansi().a(Attribute.RESET).fg(Color.BLUE).boldOff().toString());
replacements.put(ChatColor.DARK_GREEN,
  Ansi.ansi().a(Attribute.RESET).fg(Color.GREEN).boldOff().toString());
replacements.put(ChatColor.DARK_AQUA,
  Ansi.ansi().a(Attribute.RESET).fg(Color.CYAN).boldOff().toString());
replacements.put(ChatColor.DARK_RED,
  Ansi.ansi().a(Attribute.RESET).fg(Color.RED).boldOff().toString());
replacements.put(ChatColor.DARK_PURPLE,
  Ansi.ansi().a(Attribute.RESET).fg(Color.MAGENTA).boldOff().toString());
replacements.put(ChatColor.GOLD,
  Ansi.ansi().a(Attribute.RESET).fg(Color.YELLOW).boldOff().toString());
replacements.put(ChatColor.GRAY,
  Ansi.ansi().a(Attribute.RESET).fg(Color.WHITE).boldOff().toString());
replacements.put(ChatColor.DARK_GRAY,
  Ansi.ansi().a(Attribute.RESET).fg(Color.BLACK).bold().toString());
replacements
  .put(ChatColor.BLUE, Ansi.ansi().a(Attribute.RESET).fg(Color.BLUE).bold()
    .toString());
replacements
  .put(ChatColor.GREEN, Ansi.ansi().a(Attribute.RESET).fg(Color.GREEN).bold()
    .toString());
replacements
  .put(ChatColor.AQUA, Ansi.ansi().a(Attribute.RESET).fg(Color.CYAN).bold()
    .toString());
replacements
  .put(ChatColor.RED, Ansi.ansi().a(Attribute.RESET).fg(Color.RED).bold().toString());
replacements.put(ChatColor.LIGHT_PURPLE,

代码示例来源:origin: org.apache.maven.plugins/maven-surefire-report-plugin

public AnsiMessageBuilder success( Object message )
{
  Style.SUCCESS.apply( ansi ).a( message ).reset();
  return this;
}

代码示例来源:origin: prestodb/presto

Ansi ansi = Ansi.ansi();
  ansi.a(lines.get(i - 1)).newline();
ansi.a(good);
ansi.a(bad).newline();
for (int i = location.getLineNumber(); i < lines.size(); i++) {
  ansi.a(lines.get(i)).newline();
ansi.reset();
out.print(ansi);

代码示例来源:origin: SpigotMC/BungeeCord

public ColouredWriter(ConsoleReader console)
{
  this.console = console;
  replacements.put( ChatColor.BLACK, Ansi.ansi().a( Ansi.Attribute.RESET ).fg( Ansi.Color.BLACK ).boldOff().toString() );
  replacements.put( ChatColor.DARK_BLUE, Ansi.ansi().a( Ansi.Attribute.RESET ).fg( Ansi.Color.BLUE ).boldOff().toString() );
  replacements.put( ChatColor.DARK_GREEN, Ansi.ansi().a( Ansi.Attribute.RESET ).fg( Ansi.Color.GREEN ).boldOff().toString() );
  replacements.put( ChatColor.DARK_AQUA, Ansi.ansi().a( Ansi.Attribute.RESET ).fg( Ansi.Color.CYAN ).boldOff().toString() );
  replacements.put( ChatColor.DARK_RED, Ansi.ansi().a( Ansi.Attribute.RESET ).fg( Ansi.Color.RED ).boldOff().toString() );
  replacements.put( ChatColor.DARK_PURPLE, Ansi.ansi().a( Ansi.Attribute.RESET ).fg( Ansi.Color.MAGENTA ).boldOff().toString() );
  replacements.put( ChatColor.GOLD, Ansi.ansi().a( Ansi.Attribute.RESET ).fg( Ansi.Color.YELLOW ).boldOff().toString() );
  replacements.put( ChatColor.GRAY, Ansi.ansi().a( Ansi.Attribute.RESET ).fg( Ansi.Color.WHITE ).boldOff().toString() );
  replacements.put( ChatColor.DARK_GRAY, Ansi.ansi().a( Ansi.Attribute.RESET ).fg( Ansi.Color.BLACK ).bold().toString() );
  replacements.put( ChatColor.BLUE, Ansi.ansi().a( Ansi.Attribute.RESET ).fg( Ansi.Color.BLUE ).bold().toString() );
  replacements.put( ChatColor.GREEN, Ansi.ansi().a( Ansi.Attribute.RESET ).fg( Ansi.Color.GREEN ).bold().toString() );
  replacements.put( ChatColor.AQUA, Ansi.ansi().a( Ansi.Attribute.RESET ).fg( Ansi.Color.CYAN ).bold().toString() );
  replacements.put( ChatColor.RED, Ansi.ansi().a( Ansi.Attribute.RESET ).fg( Ansi.Color.RED ).bold().toString() );
  replacements.put( ChatColor.LIGHT_PURPLE, Ansi.ansi().a( Ansi.Attribute.RESET ).fg( Ansi.Color.MAGENTA ).bold().toString() );
  replacements.put( ChatColor.YELLOW, Ansi.ansi().a( Ansi.Attribute.RESET ).fg( Ansi.Color.YELLOW ).bold().toString() );
  replacements.put( ChatColor.WHITE, Ansi.ansi().a( Ansi.Attribute.RESET ).fg( Ansi.Color.WHITE ).bold().toString() );
  replacements.put( ChatColor.MAGIC, Ansi.ansi().a( Ansi.Attribute.BLINK_SLOW ).toString() );
  replacements.put( ChatColor.BOLD, Ansi.ansi().a( Ansi.Attribute.UNDERLINE_DOUBLE ).toString() );
  replacements.put( ChatColor.STRIKETHROUGH, Ansi.ansi().a( Ansi.Attribute.STRIKETHROUGH_ON ).toString() );
  replacements.put( ChatColor.UNDERLINE, Ansi.ansi().a( Ansi.Attribute.UNDERLINE ).toString() );
  replacements.put( ChatColor.ITALIC, Ansi.ansi().a( Ansi.Attribute.ITALIC ).toString() );
  replacements.put( ChatColor.RESET, Ansi.ansi().a( Ansi.Attribute.RESET ).toString() );
}

相关文章