diff --git a/Cargo.lock b/Cargo.lock index b00504a..5a7bdfd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -206,7 +206,7 @@ checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "mvw" -version = "0.1.3" +version = "0.1.4" dependencies = [ "clap", "dialoguer", diff --git a/Cargo.toml b/Cargo.toml index 848055b..dd30164 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mvw" -version = "0.1.3" +version = "0.1.5" edition = "2021" [profile.release] diff --git a/src/dirlist.rs b/src/dirlist.rs index bc412ec..2c748bd 100644 --- a/src/dirlist.rs +++ b/src/dirlist.rs @@ -56,7 +56,7 @@ impl DirList { } } - pub fn from_list(list: &Vec) -> Self { + pub fn from_list(list: &[String]) -> Self { Self { safe_source: false, noop: false, @@ -85,7 +85,7 @@ impl DirList { let src_len = self.entries.len(); let mut intermediate_files: HashMap = HashMap::new(); - self.run_basic_checks(&target_list)?; + self.run_basic_checks(target_list)?; if ! self.safe_source { println!("Implement check if target files already exist"); } @@ -95,7 +95,7 @@ impl DirList { // is the destination already in the source list? // if so, an intermediate file is needed if self.entries.iter().any(|j| j==&target_list.entries[i]) { - let unique = Self::get_unique_entry(&target_list); + let unique = Self::get_unique_entry(target_list); intermediate_files.insert(unique.clone(), target_list.entries[i].clone()); if ! self.noop { fs::rename(&self.entries[i], &unique).expect("failed to rename file"); } if self.verbose { println!("Moving {} -> {}", self.entries[i], unique); } @@ -137,7 +137,7 @@ impl DirList { // Make sure all destination files are unique in target_list let unique_entries = target_list.entries.iter().map(|x| (x, x)).collect::>(); if target_list.entries.len() != unique_entries.len() { - let doubles = self.show_doubles(&target_list); + let doubles = self.show_doubles(target_list); let error = format!("ERROR: You're trying to move multiple files to the same name.\n{}", doubles); return Err(error); } diff --git a/src/main.rs b/src/main.rs index adcb9b9..9046b5a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -38,6 +38,10 @@ struct Cli { /// Override editor to use #[arg(short, long)] editor: Option, + +// /// Apply substitution pattern(s) instead of using an editor +// #[arg(short, long)] +// pattern: Option>, }