wip 2
This commit is contained in:
+26
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user