From 7c98a00cab282a58e9f2adde65bebe431def8481 Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Wed, 30 Oct 2024 16:12:51 +1300 Subject: Add colours to info and error messages This is to match the message format printed by the bedrock-asm crate. fix --- src/bin/br.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/bin') 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); }}; } -- cgit v1.2.3-70-g09d2