17 lines
617 B
Rust
17 lines
617 B
Rust
use ansi_term::ANSIGenericString;
|
||
use ansi_term::Colour::RGB;
|
||
|
||
pub const ERR_SYMBOL: &str = "\u{276F}"; // Error indicator symbol: "❯"
|
||
pub const ERR_COL: ansi_term::Colour = RGB(255, 53, 94); // Error
|
||
pub const NORMIE_COL: ansi_term::Colour = RGB(0, 255, 180); // Success
|
||
|
||
// Error indicator
|
||
pub fn indicator(args: &[String]) -> ANSIGenericString<'static, str> {
|
||
let exit_code = args.get(1).map_or("0", String::as_str); // Default to "0" (success, no error) if arg missing
|
||
if exit_code == "0" {
|
||
NORMIE_COL.paint(ERR_SYMBOL) // Success
|
||
} else {
|
||
ERR_COL.paint(ERR_SYMBOL) // Error
|
||
}
|
||
}
|