1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use terminal_color_builder::OutputFormatter as tcb;

/// Enum for error color.
pub enum ErrColor {
	/// Yellow error message.
	Yellow,
	/// Red error message.
	Red,
}

/// Function to print and error in a specified color.
pub fn print_error(message: &str, color: ErrColor) {
	let error = match color {
		ErrColor::Yellow => tcb::new().fg().yellow(),
		ErrColor::Red => tcb::new().fg().red(),
	}
	.text(message.to_string())
	.print();
	println!("{error}");
}