#parser #linter #formatter

biome_console

Utilities to print messages (formatted with biome_markup) and diagnostics

6 releases (3 breaking)

0.4.0 Jan 9, 2024
0.3.1 Nov 26, 2023
0.1.0 Sep 28, 2023
0.0.2 Sep 28, 2023

#2672 in Development tools

Download history 61/week @ 2023-11-02 69/week @ 2023-11-09 105/week @ 2023-11-16 358/week @ 2023-11-23 61/week @ 2023-11-30 86/week @ 2023-12-07 213/week @ 2023-12-14 104/week @ 2023-12-21 146/week @ 2023-12-28 247/week @ 2024-01-04 241/week @ 2024-01-11 851/week @ 2024-01-18 1760/week @ 2024-01-25 1500/week @ 2024-02-01 1512/week @ 2024-02-08 921/week @ 2024-02-15

5,906 downloads per month
Used in 20 crates (15 directly)

MIT/Apache

70KB
1.5K SLoC

biome_console

The crate contains a general abstraction over printing messages (formatted with markup) and diagnostics to a console.

Usage example

The Console trait can be used to print two types of information to the user: messages (in the form of markup) and diagnostics:

console.message(markup! {
    <Info>"Processed "<Emphasis>{count}</Emphasis>" files"</Info>
});

console.diagnostic(
    &mut files,
    Diagnostics::error(file_id, code, title),
);

The following markup elements are supported:

  • Emphasis: Print the content in bold text
  • Dim: Print the content in dimmed text
  • Italic: Print the content in italic text
  • Underline: Print the content in underlined text
  • Error: Set the text color to red
  • Success: Set the text color to green
  • Warn: Set the text color to yellow
  • Info: Set the text color to blue

Note: Markup elements that change the "font" of the printed text (Emphasis, Dim, Italic and Underline) are not supported by the native Windows Console API and will instead get printed as ANSI control codes if the current terminal supports it, or will be ignored entirely

Dependencies

~0.7–1.3MB
~18K SLoC