mirror of
https://github.com/ouch-org/ouch.git
synced 2025-07-28 21:51:50 +00:00
doc: improve doc of resolve_path_conflict
This commit is contained in:
parent
86386b2ef0
commit
2a0b70f2bd
@ -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<Option<PathBuf>> {
|
||||
if path.exists() {
|
||||
match user_wants_to_overwrite(path, question_policy)? {
|
||||
|
Loading…
x
Reference in New Issue
Block a user