mirror of https://github.com/sunface/rust-course
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
938 B
34 lines
938 B
macro_rules! warn {
|
|
($fmt:literal, $ex:expr) => {{
|
|
use console::{style, Emoji};
|
|
use std::env;
|
|
let formatstr = format!($fmt, $ex);
|
|
if env::var("NO_EMOJI").is_ok() {
|
|
println!("{} {}", style("!").red(), style(formatstr).red());
|
|
} else {
|
|
println!(
|
|
"{} {}",
|
|
style(Emoji("⚠️ ", "!")).red(),
|
|
style(formatstr).red()
|
|
);
|
|
}
|
|
}};
|
|
}
|
|
|
|
macro_rules! success {
|
|
($fmt:literal, $ex:expr) => {{
|
|
use console::{style, Emoji};
|
|
use std::env;
|
|
let formatstr = format!($fmt, $ex);
|
|
if env::var("NO_EMOJI").is_ok() {
|
|
println!("{} {}", style("✓").green(), style(formatstr).green());
|
|
} else {
|
|
println!(
|
|
"{} {}",
|
|
style(Emoji("✅", "✓")).green(),
|
|
style(formatstr).green()
|
|
);
|
|
}
|
|
}};
|
|
}
|