mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-06 19:45:29 +00:00
chore: cargo fmt
This commit is contained in:
parent
f916f4d419
commit
e2e28b008f
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user