From 157fe016e5f335e04b4dd322623d35a244faa2ab Mon Sep 17 00:00:00 2001 From: mo8it Date: Fri, 5 Apr 2024 00:49:22 +0200 Subject: [PATCH] Remove ui.rs --- src/main.rs | 3 --- src/run.rs | 3 ++- src/ui.rs | 28 ---------------------------- src/verify.rs | 7 ++++--- 4 files changed, 6 insertions(+), 35 deletions(-) delete mode 100644 src/ui.rs diff --git a/src/main.rs b/src/main.rs index 20ec290f..c62837d3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,9 +17,6 @@ use std::time::Duration; use std::{io, thread}; use verify::VerifyState; -#[macro_use] -mod ui; - mod embedded; mod exercise; mod init; diff --git a/src/run.rs b/src/run.rs index ee2d3b4f..38f4e0e2 100644 --- a/src/run.rs +++ b/src/run.rs @@ -21,7 +21,8 @@ pub fn run(exercise: &Exercise) -> Result<()> { bail!("Ran {exercise} with errors"); } - success!("Successfully ran {}", exercise); + // TODO: Color + println!("Successfully ran {exercise}"); Ok(()) } diff --git a/src/ui.rs b/src/ui.rs deleted file mode 100644 index 22d60d96..00000000 --- a/src/ui.rs +++ /dev/null @@ -1,28 +0,0 @@ -macro_rules! print_emoji { - ($emoji:expr, $sign:expr, $color: ident, $fmt:literal, $ex:expr) => {{ - use console::{style, Emoji}; - use std::env; - let formatstr = format!($fmt, $ex); - if env::var_os("NO_EMOJI").is_some() { - println!("{} {}", style($sign).$color(), style(formatstr).$color()); - } else { - println!( - "{} {}", - style(Emoji($emoji, $sign)).$color(), - style(formatstr).$color() - ); - } - }}; -} - -macro_rules! warn { - ($fmt:literal, $ex:expr) => {{ - print_emoji!("⚠️ ", "!", red, $fmt, $ex); - }}; -} - -macro_rules! success { - ($fmt:literal, $ex:expr) => {{ - print_emoji!("✅ ", "✓", green, $fmt, $ex); - }}; -} diff --git a/src/verify.rs b/src/verify.rs index 5b053940..5beb2069 100644 --- a/src/verify.rs +++ b/src/verify.rs @@ -39,10 +39,11 @@ pub fn verify<'a>( } println!(); + // TODO: Color match exercise.mode { - Mode::Compile => success!("Successfully ran {}!", exercise), - Mode::Test => success!("Successfully tested {}!", exercise), - Mode::Clippy => success!("Successfully checked {}!", exercise), + Mode::Compile => println!("Successfully ran {exercise}!"), + Mode::Test => println!("Successfully tested {exercise}!"), + Mode::Clippy => println!("Successfully checked {exercise}!"), } if let State::Pending(context) = exercise.state()? {