mirror of
https://github.com/notohh/rustlings.git
synced 2024-12-22 00:18:09 -05:00
color output messages
This commit is contained in:
parent
18a1447a65
commit
b3c52803e9
2 changed files with 8 additions and 6 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,6 +1,4 @@
|
|||
*.swp
|
||||
target/
|
||||
|
||||
/target/
|
||||
**/*.rs.bk
|
||||
Cargo.lock
|
||||
|
|
12
src/main.rs
12
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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue