From 2a0b70f2bd5f6abb184eefa6bbac38584b465e57 Mon Sep 17 00:00:00 2001 From: Talison Fabio <54823205+talis-fb@users.noreply.github.com> Date: Sat, 22 Mar 2025 23:27:55 -0300 Subject: [PATCH] doc: improve doc of resolve_path_conflict --- src/utils/fs.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/utils/fs.rs b/src/utils/fs.rs index bb6a88d..2acac29 100644 --- a/src/utils/fs.rs +++ b/src/utils/fs.rs @@ -19,7 +19,13 @@ pub fn is_path_stdin(path: &Path) -> bool { path.as_os_str() == "-" } -/// Check if &Path exists, if it does then ask the user if they want to overwrite or rename it +/// 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 pub fn resolve_path_conflict(path: &Path, question_policy: QuestionPolicy) -> crate::Result> { if path.exists() { match user_wants_to_overwrite(path, question_policy)? {