summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Bridle <bridle.benjamin@gmail.com>2024-10-30 16:12:51 +1300
committerBen Bridle <bridle.benjamin@gmail.com>2024-10-30 16:16:05 +1300
commit7c98a00cab282a58e9f2adde65bebe431def8481 (patch)
tree1cf68537155ea601decaa26416f1ae0012afca13
parent748974ef2c0e969e95cccc9cb061436d5a1d1b35 (diff)
downloadbedrock-pc-7c98a00cab282a58e9f2adde65bebe431def8481.zip
Add colours to info and error messages
This is to match the message format printed by the bedrock-asm crate. fix
-rw-r--r--src/bin/br.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/bin/br.rs b/src/bin/br.rs
index e96df54..ed101de 100644
--- a/src/bin/br.rs
+++ b/src/bin/br.rs
@@ -6,16 +6,24 @@ use std::io::{Read, Write};
use std::path::{Path, PathBuf};
+const NORMAL: &str = "\x1b[0m";
+const BOLD: &str = "\x1b[1m";
+const WHITE: &str = "\x1b[37m";
+const RED: &str = "\x1b[31m";
+const BLUE: &str = "\x1b[34m";
+
static mut VERBOSE: bool = false;
macro_rules! verbose {
($($tokens:tt)*) => { if unsafe { VERBOSE } {
- eprint!("[INFO] "); eprintln!($($tokens)*);
+ eprint!("{BOLD}{BLUE}[INFO]: {WHITE}"); eprint!($($tokens)*);
+ eprintln!("{NORMAL}");
} };
}
macro_rules! error {
($($tokens:tt)*) => {{
- eprint!("[ERROR] "); eprintln!($($tokens)*); std::process::exit(1);
+ eprint!("{BOLD}{RED}[ERROR]: {WHITE}"); eprint!($($tokens)*);
+ eprintln!("{NORMAL}"); std::process::exit(1);
}};
}