use crate::commands::ColorSupport;
use std::path::PathBuf;
use std::rc::Rc;
use tracing::instrument;
#[derive(Debug, Clone)]
pub struct ListData {
pub(crate) target: PathBuf,
pub(crate) directory: PathBuf,
pub(crate) dot_file_prefix: Option<String>,
pub(crate) color_support: Rc<ColorSupport>,
}
impl ListData {
#[must_use]
#[instrument(level = "trace")]
pub fn new(
target: PathBuf,
directory: PathBuf,
dot_file_prefix: Option<String>,
color_support: ColorSupport,
) -> Self {
Self {
target,
directory,
dot_file_prefix,
color_support: Rc::new(color_support),
}
}
#[must_use]
pub fn clone_with_target(&self, target: PathBuf) -> Self {
Self {
target,
directory: self.directory.clone(),
dot_file_prefix: self.dot_file_prefix.clone(),
color_support: Rc::clone(&self.color_support),
}
}
}