Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ ignore-hidden=true
output-format="si"

number-of-lines=5

# To keep the .git directory collapsed
collapse=[".git"]
9 changes: 9 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ pub struct Config {
pub files0_from: Option<String>,
pub number_of_lines: Option<usize>,
pub files_from: Option<String>,
pub collapse: Option<Vec<String>>,
}

impl Config {
Expand Down Expand Up @@ -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<Vec<String>> {
if self.collapse.is_none() {
options.collapse.clone()
} else {
self.collapse.clone()
}
}
}

fn get_current_date_epoch_seconds() -> i64 {
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ fn main() {
indicator.spawn(output_format.clone())
}

let keep_collapsed: HashSet<PathBuf> = match options.collapse {
let keep_collapsed: HashSet<PathBuf> = match config.get_collapse(&options) {
Some(ref collapse) => {
let mut combined_dirs = HashSet::new();
for collapse_dir in collapse {
Expand Down
Loading