From b3c52803e97a5bef5fbe1e26ce4f8ba9b9d26b7d Mon Sep 17 00:00:00 2001 From: olivia Date: Wed, 14 Nov 2018 19:23:16 +0100 Subject: [PATCH] color output messages --- .gitignore | 2 -- src/main.rs | 12 ++++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 798c8732..6aac0d45 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,4 @@ *.swp target/ - -/target/ **/*.rs.bk Cargo.lock diff --git a/src/main.rs b/src/main.rs index a144e3a5..509e0554 100644 --- a/src/main.rs +++ b/src/main.rs @@ -85,10 +85,12 @@ fn compile_only(filename: &str) { .expect("fail"); bar.finish_and_clear(); if compilecmd.status.success() { - println!("{} Successfully compiled {}!", Emoji("✅", "✓"), style(filename).italic()); + let formatstr = format!("{} Successfully compiled {}!", Emoji("✅", "✓"), filename); + println!("{}", style(formatstr).green()); clean().unwrap(); } else { - println!("{} Compilation of {} failed! Compiler error message:\n", Emoji("⚠️ ", "!"), style(filename).italic()); + let formatstr = format!("{} Compilation of {} failed! Compiler error message:\n", Emoji("⚠️ ", "!"), filename); + println!("{}", style(formatstr).red()); println!("{}", String::from_utf8_lossy(&compilecmd.stderr)); clean().unwrap(); std::process::exit(1); @@ -105,10 +107,12 @@ fn test(filename: &str) { .expect("fail"); bar.finish_and_clear(); if testcmd.status.success() { - println!("{} Successfully tested {}!", Emoji("✅", "✓"), style(filename).italic()); + let formatstr = format!("{} Successfully tested {}!", Emoji("✅", "✓"), filename); + println!("{}", style(formatstr).green()); clean().unwrap(); } else { - println!("{} Testing of {} failed! Please try again.", Emoji("⚠️ ", "!"), style(filename).italic()); + let formatstr = format!("{} Testing of {} failed! Please try again.", Emoji("⚠️ ", "!"), filename); + println!("{}", style(formatstr).red()); clean().unwrap(); std::process::exit(1); }