pub mod pager;
pub mod pb;
pub mod writer;
use std::sync::atomic::AtomicBool;
pub use console;
pub use indicatif;
use once_cell::sync::Lazy;
use writer::Writer;
pub static WRITER: Lazy<Writer> = Lazy::new(writer::Writer::default);
pub static DEBUG: AtomicBool = AtomicBool::new(false);
pub fn is_terminal() -> bool {
WRITER.is_terminal()
}
#[macro_export]
macro_rules! msg {
($($arg:tt)+) => {
oma_console::WRITER.writeln("", &format!($($arg)+)).ok();
};
}
#[macro_export]
macro_rules! debug {
($($arg:tt)+) => {
if oma_console::DEBUG.load(std::sync::atomic::Ordering::Relaxed) {
oma_console::WRITER.writeln(&oma_console::console::style("DEBUG").dim().to_string(), &format!($($arg)+)).ok();
}
};
}
#[macro_export]
macro_rules! success {
($($arg:tt)+) => {
oma_console::WRITER.writeln(&oma_console::console::style("SUCCESS").green().bold().to_string(), &format!($($arg)+)).ok();
};
}
#[macro_export]
macro_rules! info {
($($arg:tt)+) => {
oma_console::WRITER.writeln(&oma_console::console::style("INFO").blue().bold().to_string(), &format!($($arg)+)).ok();
};
}
#[macro_export]
macro_rules! warn {
($($arg:tt)+) => {
oma_console::WRITER.writeln(&oma_console::console::style("WARNING").yellow().bold().to_string(), &format!($($arg)+)).ok();
};
}
#[macro_export]
macro_rules! error {
($($arg:tt)+) => {
oma_console::WRITER.writeln(&oma_console::console::style("ERROR").red().bold().to_string(), &format!($($arg)+)).ok();
};
}
#[macro_export]
macro_rules! due_to {
($($arg:tt)+) => {
oma_console::WRITER.writeln(&oma_console::console::style("DUE TO").yellow().bold().to_string(), &format!($($arg)+)).ok();
};
}