use colored::{ColoredString, Colorize};
pub struct LogOptions {
pub border: Option<char>,
pub border_bottom: Option<char>,
pub quiet: bool,
}
pub fn log(text: ColoredString, options: LogOptions) {
if options.quiet {
return; }
let mut border_string = ColoredString::from("");
if let Some(border) = options.border {
let border_length = 79; let border_color = text.fgcolor();
let buffer = std::iter::repeat(border)
.take(border_length)
.collect::<String>();
border_string = ColoredString::from(buffer.as_str());
if let Some(color) = border_color {
border_string = border_string.color(color);
}
println!("{}{}", border_string, ColoredString::from("").clear());
}
println!("{}{}", text, ColoredString::from("").clear());
if let Some(_border_bottom) = options.border_bottom {
} else if !border_string.is_empty() {
println!("{}{}", border_string, ColoredString::from("").clear());
}
}