diff options
| author | Matt Lebl <lebl.matt@gmail.com> | 2021-03-19 02:16:07 -0700 |
|---|---|---|
| committer | Matt Lebl <lebl.matt@gmail.com> | 2021-03-19 02:16:07 -0700 |
| commit | 8d62a9963708dbecd9312e8bcc4b47049c72d155 (patch) | |
| tree | 3c5b973e1f1250624b709544e0d60bd607bf87a1 /src/ui.rs | |
| parent | 0d894e6ff739943901e1ae8c904582e5c2f843bd (diff) | |
feat: Replace emojis when NO_EMOJI env variable present
Diffstat (limited to 'src/ui.rs')
| -rw-r--r-- | src/ui.rs | 44 |
1 files changed, 34 insertions, 10 deletions
@@ -1,23 +1,47 @@ 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() - ); + match env::var("NO_EMOJI").is_ok() { + true => { + println!( + "{} {}", + style("!").red(), + style(formatstr).red() + ); + }, + false => { + 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() - ); + match env::var("NO_EMOJI").is_ok() { + true => { + println!( + "{} {}", + style("✓").green(), + style(formatstr).green() + ); + }, + false => { + println!( + "{} {}", + style(Emoji("✅", "✓")).green(), + style(formatstr).green() + ); + } + } }}; } |
