This commit is contained in:
2026-05-18 20:39:21 +02:00
parent 0d610fd2de
commit 0c9a3fde94
9 changed files with 930 additions and 22 deletions
+26
View File
@@ -0,0 +1,26 @@
use std::{io::IsTerminal, sync::LazyLock};
static IS_STDERR_TERMINAL: LazyLock<bool> = LazyLock::new(|| std::io::stderr().is_terminal());
const ARROW: &str = "==>";
fn emit(color: &str, action: &str, details: &str) {
if *IS_STDERR_TERMINAL {
eprintln!("\x1b[{color}m{ARROW} \x1b[1m{action} \x1b[0m{details}");
} else {
eprintln!("{ARROW} {action} {details}");
}
}
pub fn step(action: &str, details: &str) {
emit("1;34", action, details);
}
pub fn skip(action: &str, details: &str) {
emit("1;33", action, details);
}
#[allow(dead_code)]
pub fn info(action: &str, details: &str) {
emit("1;32", action, details);
}