18 lines
616 B
Rust
18 lines
616 B
Rust
use ansi_term::ANSIGenericString;
|
||
use ansi_term::Colour::RGB;
|
||
|
||
// Error indicator symbol
|
||
pub const ERR_SYMBOL: &str = "\u{276F}"; // "❯"
|
||
pub const ERR_COL: ansi_term::Colour = RGB(255, 53, 94); //
|
||
pub const NORMIE_COL: ansi_term::Colour = RGB(0, 255, 180); //
|
||
|
||
// Error indicator
|
||
pub fn indicator(args: Vec<String>) -> ANSIGenericString<'static, str> {
|
||
let default_exit_code = "0".to_string();
|
||
let exit_code = args.get(1).unwrap_or(&default_exit_code); // Default to "0" if missing
|
||
match exit_code.as_str() {
|
||
"0" => NORMIE_COL.paint(ERR_SYMBOL),
|
||
_ => ERR_COL.paint(ERR_SYMBOL),
|
||
}
|
||
}
|