Skip to content

Commit

Permalink
color output messages
Browse files Browse the repository at this point in the history
  • Loading branch information
olivia committed Nov 14, 2018
1 parent 18a1447 commit b3c5280
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
*.swp
target/

/target/
**/*.rs.bk
Cargo.lock
12 changes: 8 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}
Expand Down

0 comments on commit b3c5280

Please sign in to comment.