mirror of https://github.com/rust-lang/rustlings
Merge pull request #676 from blerchy/feat/no-emoji
Replace emojis when NO_EMOJI env variable presentpull/680/head
commit
b350945a16
@ -1,23 +1,41 @@
|
||||
macro_rules! warn {
|
||||
($fmt:literal, $ex:expr) => {{
|
||||
use std::env;
|
||||
use console::{style, Emoji};
|
||||
let formatstr = format!($fmt, $ex);
|
||||
println!(
|
||||
"{} {}",
|
||||
style(Emoji("⚠️ ", "!")).red(),
|
||||
style(formatstr).red()
|
||||
);
|
||||
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 std::env;
|
||||
use console::{style, Emoji};
|
||||
let formatstr = format!($fmt, $ex);
|
||||
println!(
|
||||
"{} {}",
|
||||
style(Emoji("✅", "✓")).green(),
|
||||
style(formatstr).green()
|
||||
);
|
||||
if env::var("NO_EMOJI").is_ok() {
|
||||
println!(
|
||||
"{} {}",
|
||||
style("✓").green(),
|
||||
style(formatstr).green()
|
||||
);
|
||||
} else {
|
||||
println!(
|
||||
"{} {}",
|
||||
style(Emoji("✅", "✓")).green(),
|
||||
style(formatstr).green()
|
||||
);
|
||||
}
|
||||
}};
|
||||
}
|
||||
|
Loading…
Reference in New Issue