use console::Style;
use std::io::{self, Write};
#[allow(dead_code)]
pub fn success(message: &str) {
let style = Style::new().green().bold();
println!("{} {}", style.apply_to("✓"), message);
}
#[allow(dead_code)]
pub fn info(message: &str) {
let style = Style::new().blue().bold();
println!("{} {}", style.apply_to("ℹ"), message);
}
#[allow(dead_code)]
pub fn warning(message: &str) {
let style = Style::new().yellow().bold();
eprintln!("{} {}", style.apply_to("⚠"), message);
}
#[allow(dead_code)]
pub fn error(message: &str) {
let style = Style::new().red().bold();
eprintln!("{} {}", style.apply_to("✗"), message);
}
pub fn header(title: &str) {
let style = Style::new().bold().underlined();
println!("\n{}", style.apply_to(title));
}
pub fn section(title: &str) {
let style = Style::new().bold();
println!("\n{}", style.apply_to(title));
}
pub fn key_value(key: &str, value: &str) {
let style = Style::new().bold();
println!("{}: {}", style.apply_to(key), value);
}
#[allow(dead_code)]
pub fn list_item(message: &str) {
println!(" • {message}");
}
#[allow(dead_code)]
pub fn confirm(message: &str) -> io::Result<bool> {
print!("{message} [y/N] ");
io::stdout().flush()?;
let mut input = String::new();
io::stdin().read_line(&mut input)?;
Ok(matches!(input.trim().to_lowercase().as_str(), "y" | "yes"))
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_output_functions() {
header("Test Header");
section("Test Section");
key_value("Key", "Value");
success("Success message");
info("Info message");
warning("Warning message");
error("Error message");
list_item("List item");
}
}