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

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

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

Ansi.bold介绍

暂无

代码示例

代码示例来源: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: io.github.christian-draeger/page-content-tester

@Override
public void testFinished(Description description) {
  System.out.println("\uD83C\uDFC1 " + ansi().fgBrightCyan().bold().a("finished test: ").reset() + description.getDisplayName());
}

代码示例来源: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: io.github.christian-draeger/page-content-tester

@Override
public void testRunFinished(Result result) throws Exception {
  if (result.wasSuccessful()) {
    System.out.println(ansi().fgGreen().bold().a("\u2705 SUCCESS\t: all " + result.getRunCount() + " executed tests passed").reset());
  } else {
    System.out.println(ansi().fgRed().bold().a("\uD83D\uDED1 DAMN IT\t: " + result.getFailureCount() + " of " + result.getRunCount() + " executed tests failed").reset());
  }
  System.out.println(ansi().fgBrightBlack().bold().a("\uD83D\uDD57 TIME\t\t: test run took " + getElapsedTime(startTime) + " seconds (without maven ramp up)").reset());
}

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

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,
  Ansi.ansi().a(Attribute.RESET).fg(Color.MAGENTA).bold().toString());
replacements.put(ChatColor.YELLOW,
  Ansi.ansi().a(Attribute.RESET).fg(Color.YELLOW).bold().toString());
replacements
  .put(ChatColor.WHITE, Ansi.ansi().a(Attribute.RESET).fg(Color.WHITE).bold()
    .toString());
replacements.put(ChatColor.MAGIC, Ansi.ansi().a(Attribute.BLINK_SLOW).toString());

代码示例来源:origin: io.github.christian-draeger/page-content-tester

@Override
public void testFailure(Failure failure) throws Exception {
  System.out.println("\u26d4 " + ansi().fgRed().bold().a("failing test: ").reset() + failure.getDescription().getDisplayName());
}

代码示例来源:origin: jamesagnew/hapi-fhir

private void logAppHeader() {
  System.out.flush();
  System.out.println("------------------------------------------------------------");
  System.out.println("\ud83d\udd25 " + ansi().bold() + " " + provideProductName() + ansi().boldOff() + " " + provideProductVersion() + " - Command Line Tool");
  System.out.println("------------------------------------------------------------");
  System.out.println("Process ID                      : " + ManagementFactory.getRuntimeMXBean().getName());
  System.out.println("Max configured JVM memory (Xmx) : " + FileHelper.getFileSizeDisplay(Runtime.getRuntime().maxMemory(), 1));
  System.out.println("Detected Java version           : " + System.getProperty("java.version"));
  System.out.println("------------------------------------------------------------");
}

代码示例来源:origin: org.testifyproject.tools/test-logger

String getMagentaMessage(String loggerName) {
  return ansi()
      .bold()
      .fgMagenta()
      .a(loggerName)
      .reset()
      .toString();
}

代码示例来源:origin: jamesagnew/hapi-fhir

protected String promptUser(String thePrompt) throws ParseException {
  System.out.print(ansi().bold().fgBrightDefault());
  System.out.print(thePrompt);
  System.out.print(ansi().boldOff().fgBlack().bgDefault());
  System.out.flush();
  Console console = System.console();
  String retVal;
  if (console == null) {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    try {
      retVal = reader.readLine();
    } catch (IOException e) {
      throw new ParseException("Failed to read input from user: " + e.toString());
    }
  } else {
    retVal = new String(console.readPassword());
  }
  System.out.print(ansi().boldOff().fgDefault().bgDefault());
  return retVal;
}

代码示例来源:origin: jamesagnew/hapi-fhir

private void logUsage() {
  logAppHeader();
  System.out.println("Usage:");
  System.out.println("  " + provideCommandName() + " {command} [options]");
  System.out.println();
  System.out.println("Commands:");
  int longestCommandLength = 0;
  for (BaseCommand next : ourCommands) {
    longestCommandLength = Math.max(longestCommandLength, next.getCommandName().length());
  }
  for (BaseCommand next : ourCommands) {
    String left = "  " + StringUtils.rightPad(next.getCommandName(), longestCommandLength);
    String[] rightParts = WordUtils.wrap(next.getCommandDescription(), 80 - (left.length() + 3)).split("\\n");
    for (int i = 1; i < rightParts.length; i++) {
      rightParts[i] = StringUtils.leftPad("", left.length() + 3) + rightParts[i];
    }
    System.out.println(ansi().bold().fg(Ansi.Color.GREEN) + left + ansi().boldOff().fg(Ansi.Color.WHITE) + " - " + ansi().bold() + StringUtils.join(rightParts, LINESEP));
  }
  System.out.println();
  System.out.println(ansi().boldOff().fg(Ansi.Color.WHITE) + "See what options are available:");
  System.out.println("  " + provideCommandName() + " help {command}");
  System.out.println();
}

代码示例来源: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() );
}

代码示例来源:origin: jamesagnew/hapi-fhir

String message = "Unrecognized command: " + ansi().bold().fg(Ansi.Color.RED) + theArgs[0] + ansi().boldOff().fg(Ansi.Color.WHITE);
System.out.println(message);
System.out.println();
System.err.println("  " + ansi().fg(Ansi.Color.RED).bold() + e.getMessage());
System.err.println("" + ansi().fg(Ansi.Color.WHITE).boldOff());
logCommandUsageNoHeader(command);

代码示例来源:origin: com.tngtech.jgiven/jgiven-core

String bold( String text ) {
  if( withColor ) {
    return Ansi.ansi().bold().a( text ).boldOff().toString();
  }
  return text;
}

代码示例来源:origin: dCache/dcache

@Override
  protected String heading(String heading)
  {
    return ansi().bold().a(heading).boldOff().toString();
  }
}

代码示例来源:origin: dCache/dcache

@Override
protected String literal(String option)
{
  return ansi().bold().a(option).boldOff().toString();
}

代码示例来源:origin: com.facebook.presto.hive/hive-apache

/**
 * 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
 */
public 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: aliyun/aliyun-odps-console

/**
 * 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
 */
public static void reprintLineWithColorAsBold(PrintStream out, String line, Ansi.Color color) {
 out.print(ansi().eraseLine(Ansi.Erase.ALL).fg(color).bold().a(line).a('\n').boldOff().reset()
        .toString());
 out.flush();
}

代码示例来源:origin: org.apache.hive/hive-common

/**
 * 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: org.jledit/core

/**
 * Displays Text highlighting the text that was marked as highlighted.
 *
 * @param text
 */
protected void displayText(String text) {
  if (highLight != null && !highLight.isEmpty() && text.contains(highLight)) {
    String highLightedText = text.replaceAll(highLight, ansi().bold().bg(theme.getHighLightBackground()).fg(theme.getHighLightForeground()).a(highLight).boldOff().reset().toString());
    console.out().print(highLightedText);
  } else {
    console.out().print(text);
  }
}

代码示例来源:origin: com.dslplatform/dsl-clc

private void askSafe(final String question, final Color color) {
  if (withColor) {
    try {
      write(console, false, Ansi.ansi().fgBright(color).bold().a(question + " ").boldOff().reset().toString());
      return;
    } catch (NoSuchMethodError ignore) {
      warning("Incompatible jansi found on classpath. Reverting to no-color");
      withColor = false;
    }
  }
  write(console, false, question + " ");
}

相关文章