added filetype filter

This commit is contained in:
sreedev
2023-07-17 14:06:57 -04:00
parent e3d48ec505
commit dcc709a666
2 changed files with 9 additions and 2 deletions

View File

@@ -46,4 +46,8 @@ impl Params {
let dir = fs::canonicalize(dir_path)?;
Ok(dir)
}
pub fn get_types(&self) -> Option<String> {
self.types.clone()
}
}

View File

@@ -36,6 +36,10 @@ impl Scanner {
Some(min_size) => scanner.min_size(min_size),
None => scanner,
})
.map(|scanner| match app_args.get_types() {
Some(ftypes) => scanner.filetypes(ftypes),
None => scanner,
})
.map(|scanner| match app_args.min_depth {
Some(min_depth) => scanner.min_depth(min_depth),
None => scanner,
@@ -142,8 +146,7 @@ impl Scanner {
}
pub fn scan(&self) -> Result<Vec<FileInfo>> {
let progress_style =
ProgressStyle::with_template("[{elapsed_precise}] {pos:>7} {msg}")?;
let progress_style = ProgressStyle::with_template("[{elapsed_precise}] {pos:>7} {msg}")?;
let progress_bar = ProgressBar::new_spinner();
progress_bar.set_style(progress_style);
progress_bar.enable_steady_tick(Duration::from_millis(50));