2024-03-15 12:51:24 +00:00
|
|
|
macro_rules! print_emoji {
|
2024-03-21 07:18:50 +00:00
|
|
|
($emoji:expr, $sign:expr, $color: ident, $fmt:literal, $ex:expr) => {{
|
2020-02-20 19:11:53 +00:00
|
|
|
use console::{style, Emoji};
|
2021-04-18 13:40:47 +00:00
|
|
|
use std::env;
|
2020-02-20 19:11:53 +00:00
|
|
|
let formatstr = format!($fmt, $ex);
|
2021-03-20 18:52:57 +00:00
|
|
|
if env::var("NO_EMOJI").is_ok() {
|
2024-03-15 12:51:24 +00:00
|
|
|
println!("{} {}", style($sign).$color(), style(formatstr).$color());
|
2021-03-20 18:52:57 +00:00
|
|
|
} else {
|
|
|
|
println!(
|
|
|
|
"{} {}",
|
2024-03-15 12:51:24 +00:00
|
|
|
style(Emoji($emoji, $sign)).$color(),
|
|
|
|
style(formatstr).$color()
|
2021-03-20 18:52:57 +00:00
|
|
|
);
|
2021-03-19 09:16:07 +00:00
|
|
|
}
|
2020-02-20 19:11:53 +00:00
|
|
|
}};
|
|
|
|
}
|
|
|
|
|
2024-03-15 12:51:24 +00:00
|
|
|
macro_rules! warn {
|
|
|
|
($fmt:literal, $ex:expr) => {{
|
|
|
|
print_emoji!("⚠️ ", "!", red, $fmt, $ex);
|
|
|
|
}};
|
|
|
|
}
|
|
|
|
|
2020-02-20 19:11:53 +00:00
|
|
|
macro_rules! success {
|
|
|
|
($fmt:literal, $ex:expr) => {{
|
2024-03-15 12:51:24 +00:00
|
|
|
print_emoji!("✅ ", "✓", green, $fmt, $ex);
|
2020-02-20 19:11:53 +00:00
|
|
|
}};
|
|
|
|
}
|