pub mod accessibility;
pub mod align_widget;
pub mod ansi;
#[cfg(feature = "anstyle")]
pub mod anstyle_adapter;
pub mod bar;
pub mod box_chars;
pub mod canvas;
pub mod cells;
pub mod color;
pub mod color_env;
pub mod color_triplet;
pub mod columns;
pub mod console;
pub mod constrain;
pub mod containers;
pub mod control;
pub mod csv_table;
pub mod default_styles;
pub mod diff;
pub mod emoji;
pub mod emoji_codes;
pub mod emoji_replace;
pub mod errors;
pub mod export_format;
#[cfg(feature = "eyre")]
pub mod eyre_handler;
pub mod figlet;
pub mod filesize;
pub mod gradient;
pub mod group;
pub mod highlighter;
pub mod inspect;
#[cfg(feature = "json")]
pub mod json;
pub mod layout;
pub mod live;
pub mod live_render;
pub mod logging_handler;
#[cfg(feature = "markdown")]
pub mod markdown;
pub mod markup;
pub mod measure;
#[cfg(feature = "miette")]
pub mod miette_handler;
pub mod padding;
pub mod pager;
pub mod palette;
pub mod panel;
pub mod prelude;
pub mod pretty;
pub mod progress;
pub mod progress_bar;
pub mod prompt;
pub mod ratio;
pub mod region;
pub mod rule;
pub mod scope;
pub mod screen;
pub mod segment;
pub mod sparkline;
pub mod spinner;
pub mod spinners;
pub mod status;
pub mod style;
pub mod styled;
pub mod styled_str;
#[cfg(feature = "syntax")]
pub mod syntax;
pub mod table;
pub mod terminal_theme;
pub mod text;
pub mod theme;
pub mod traceback;
#[cfg(feature = "tracing")]
pub mod tracing_layer;
pub mod tree;
pub mod wrap;
#[cfg(feature = "derive")]
pub use gilt_derive::Columns as DeriveColumns;
#[cfg(feature = "derive")]
pub use gilt_derive::Panel;
#[cfg(feature = "derive")]
pub use gilt_derive::Renderable;
#[cfg(feature = "derive")]
pub use gilt_derive::Table;
#[cfg(feature = "derive")]
pub use gilt_derive::Tree;
#[cfg(feature = "derive")]
pub use gilt_derive::Rule as DeriveRule;
#[cfg(feature = "derive")]
pub use gilt_derive::Inspect as DeriveInspect;
use std::sync::LazyLock;
use std::sync::Mutex;
static DEFAULT_CONSOLE: LazyLock<Mutex<console::Console>> =
LazyLock::new(|| Mutex::new(console::Console::new()));
pub fn with_console<F, R>(f: F) -> R
where
F: FnOnce(&mut console::Console) -> R,
{
let mut c = DEFAULT_CONSOLE.lock().expect("console mutex poisoned");
f(&mut c)
}
pub fn print(renderable: &dyn console::Renderable) {
with_console(|c| c.print(renderable));
}
pub fn print_text(text: &str) {
with_console(|c| c.print_text(text));
}
#[cfg(feature = "json")]
pub fn print_json(json: &str) {
with_console(|c| c.print_json(json));
}
pub fn inspect<T: std::fmt::Debug + 'static>(value: &T) {
with_console(|c| c.inspect(value));
}