diff --git a/src/utils/fs.rs b/src/utils/fs.rs index d4cb8a5..c6ffb8a 100644 --- a/src/utils/fs.rs +++ b/src/utils/fs.rs @@ -22,7 +22,7 @@ pub fn is_path_stdin(path: &Path) -> bool { /// Check if &Path exists, if it does then ask the user if they want to overwrite or rename it. /// If the user want to overwrite then the file or directory will be removed and returned the same input path /// If the user want to rename then nothing will be removed and a new path will be returned with a new name -/// +/// /// * `Ok(None)` means the user wants to cancel the operation /// * `Ok(Some(path))` returns a valid PathBuf without any another file or directory with the same name /// * `Err(_)` is an error diff --git a/src/utils/question.rs b/src/utils/question.rs index 781c868..bff7284 100644 --- a/src/utils/question.rs +++ b/src/utils/question.rs @@ -45,7 +45,7 @@ pub enum FileConflitOperation { Cancel, /// Overwrite the existing file with the new one Overwrite, - /// Rename the file + /// Rename the file /// It'll be put "_1" at the end of the filename or "_2","_3","_4".. if already exists Rename, } @@ -223,10 +223,7 @@ impl<'a, T: Default> ChoicePrompt<'a, T> { answer.make_ascii_lowercase(); let answer = answer.trim(); - let chosen_index = self - .choises - .iter() - .position(|choise| choise.label.starts_with(answer)); + let chosen_index = self.choises.iter().position(|choise| choise.label.starts_with(answer)); if let Some(i) = chosen_index { return Ok(self.choises.remove(i).value);