#parser #formatter #linter

biome_console

Utilities to print messages (formatted with biome_markup) and diagnostics

10 releases (4 breaking)

0.5.7 Mar 12, 2024
0.5.6 Mar 12, 2024
0.4.0 Jan 9, 2024
0.3.1 Nov 26, 2023
0.0.2 Sep 28, 2023

#447 in Web programming

Download history 6721/week @ 2024-06-14 5290/week @ 2024-06-21 8634/week @ 2024-06-28 6029/week @ 2024-07-05 3010/week @ 2024-07-12 6843/week @ 2024-07-19 7347/week @ 2024-07-26 6225/week @ 2024-08-02 10341/week @ 2024-08-09 7517/week @ 2024-08-16 15282/week @ 2024-08-23 9108/week @ 2024-08-30 14181/week @ 2024-09-06 5072/week @ 2024-09-13 13676/week @ 2024-09-20 16898/week @ 2024-09-27

51,576 downloads per month
Used in 23 crates (16 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

~1.5–9MB
~71K SLoC