use colored::Colorize;
use dotenv_finder::FileEntry;
use crate::diff::DiffWarning;
pub struct DiffOutput {
is_quiet_mode: bool,
}
impl DiffOutput {
pub fn new(is_quiet_mode: bool) -> Self {
DiffOutput { is_quiet_mode }
}
pub fn print_processing_info(&self, file: &FileEntry) {
if !self.is_quiet_mode {
println!("Comparing {file}");
}
}
pub fn print_warnings(&self, warnings: &[DiffWarning]) {
warnings.iter().for_each(|w| {
println!(
"{} is missing keys: {}",
w.path().display().to_string().italic(),
w.missing_keys()
.iter()
.map(|k| k.red().bold().to_string())
.collect::<Vec<String>>()
.join(", ")
)
})
}
pub fn print_nothing_to_compare(&self) {
if !self.is_quiet_mode {
println!("Nothing to compare");
}
}
pub fn print_no_difference_found(&self) {
if !self.is_quiet_mode {
println!("No difference found");
}
}
}