use std::fmt::{self, Debug, Display};
#[derive(Clone, Copy, Debug, Default)]
pub struct UntreeOptions {
pub(crate) dry_run: bool,
pub(crate) verbose: bool,
}
impl UntreeOptions {
pub fn new() -> Self {
Default::default()
}
#[must_use]
pub fn dry_run(self, dry_run: bool) -> UntreeOptions {
Self { dry_run, ..self }
}
#[must_use]
pub fn verbose(self, verbose: bool) -> UntreeOptions {
Self { verbose, ..self }
}
pub fn is_dry_run(&self) -> bool {
self.dry_run
}
pub fn is_verbose(&self) -> bool {
self.verbose || self.dry_run
}
}
#[derive(Clone, Copy, Debug)]
pub enum PathKind {
FilePath,
Directory,
}
impl Display for PathKind {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{self:?}")
}
}
impl Display for UntreeOptions {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{self:?}")
}
}