color output messages

This commit is contained in:
olivia 2018-11-14 19:23:16 +01:00
parent 18a1447a65
commit b3c52803e9
2 changed files with 8 additions and 6 deletions

2
.gitignore vendored
View file

@ -1,6 +1,4 @@
*.swp
target/
/target/
**/*.rs.bk
Cargo.lock

View file

@ -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);
}