use std::path::Path;
use crate::output::json::JsonReporter;
use crate::output::reporter::Reporter;
use crate::output::text::TextReporter;
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, clap::ValueEnum)]
pub enum OutputFormat {
#[default]
Text,
Json,
}
impl OutputFormat {
#[must_use]
pub fn reporter(self, root: Option<&Path>) -> Box<dyn Reporter> {
match self {
Self::Text => Box::new(TextReporter::new(root.map(Path::to_path_buf))),
Self::Json => Box::new(JsonReporter::new(root.map(Path::to_path_buf))),
}
}
}