incremental hashing + remove sqlite + mmap file reads

This commit is contained in:
sreedev
2023-01-17 23:40:57 -05:00
parent 175c7579c4
commit 51f5f8e61a
8 changed files with 102 additions and 209 deletions

View File

@@ -1,6 +1,6 @@
use std::{fs, path::PathBuf};
use anyhow::{anyhow, Result};
use clap::Parser;
use std::{fs, path::PathBuf};
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
@@ -11,9 +11,6 @@ pub struct Params {
/// Run Deduplicator on dir different from pwd
#[arg(long)]
pub dir: Option<PathBuf>,
/// Don't use cache for indexing files (default = false)
#[arg(long, short)]
pub nocache: bool,
/// Delete files interactively
#[arg(long, short)]
pub interactive: bool,
@@ -36,4 +33,18 @@ impl Params {
Ok(dir)
}
pub fn get_glob_patterns(&self) -> Vec<PathBuf> {
self.types
.clone()
.unwrap_or_else(|| String::from("*"))
.split(',')
.map(|filetype| format!("*.{}", filetype))
.map(|filetype| {
vec![self.get_directory().unwrap(), String::from("**"), filetype]
.iter()
.collect()
})
.collect()
}
}