use super::*; use lazy_static::lazy_static; #[derive(Debug, Clone)] pub enum RecursionMode { None, All, N(usize), } #[derive(Debug, Clone)] pub enum OperationMode { Print, Delete, } #[derive(Debug, Clone)] pub struct Mode { pub error_mode: error::Mode, pub recursion_mode: RecursionMode, pub operation_mode: OperationMode, pub logging_mode: log::Mode, } impl Default for Mode { fn default() -> Self { Self { error_mode: error::Mode::Cancel, recursion_mode: RecursionMode::None, operation_mode: OperationMode::Print, logging_mode: log::Mode::Warn, } } } lazy_static! { pub static ref DEFAULT_HASHNAME: &'static str = { let string = expand_path(DEFAULT_HASHNAME_STRING); Box::leak(string.into_boxed_str()) }; } const DEFAULT_HASHNAME_STRING: &'static str = "~/.rmdupe"; /// Expand path for shell fn expand_path(path: impl AsRef) -> String { shellexpand::tilde(path.as_ref()).to_string() } #[derive(Debug)] pub struct Config { /// Paths to dupde-check pub paths: Vec, /// operation mode pub mode: Mode, /// Save hashes to pub save: Vec, /// Load hashes from pub load: Vec, } #[derive(Debug)] pub struct Rebase { /// Load from here pub load: Vec, /// Rebase to here pub save: Vec, }