diff --git a/config/config.toml b/config/config.toml index b3b0fa6c..9b43aa67 100644 --- a/config/config.toml +++ b/config/config.toml @@ -28,3 +28,6 @@ ignore-hidden=true output-format="si" number-of-lines=5 + +# To keep the .git directory collapsed +collapse=[".git"] diff --git a/src/config.rs b/src/config.rs index 66193311..141500e3 100644 --- a/src/config.rs +++ b/src/config.rs @@ -38,6 +38,7 @@ pub struct Config { pub files0_from: Option, pub number_of_lines: Option, pub files_from: Option, + pub collapse: Option>, } impl Config { @@ -177,6 +178,14 @@ impl Config { pub fn get_changed_time_operator(&self, options: &Cli) -> Option<(Operator, i64)> { get_filter_time_operator(options.ctime.as_ref(), get_current_date_epoch_seconds()) } + + pub fn get_collapse(&self, options: &Cli) -> Option> { + if self.collapse.is_none() { + options.collapse.clone() + } else { + self.collapse.clone() + } + } } fn get_current_date_epoch_seconds() -> i64 { diff --git a/src/main.rs b/src/main.rs index 5e80681b..b9c75937 100644 --- a/src/main.rs +++ b/src/main.rs @@ -224,7 +224,7 @@ fn main() { indicator.spawn(output_format.clone()) } - let keep_collapsed: HashSet = match options.collapse { + let keep_collapsed: HashSet = match config.get_collapse(&options) { Some(ref collapse) => { let mut combined_dirs = HashSet::new(); for collapse_dir in collapse {