From d4630c83b4aec9e3b122f2a486c4b99299d21ddd Mon Sep 17 00:00:00 2001 From: John Shin Date: Tue, 25 Apr 2023 21:27:52 -0700 Subject: [PATCH] mv: add 'renamed ' in the beginning when verbose flag is set --- src/uu/mv/src/mv.rs | 4 ++-- tests/by-util/test_mv.rs | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index d0a1a766f..b79c43ad3 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -455,12 +455,12 @@ fn rename( if b.verbose { let message = match backup_path { Some(path) => format!( - "{} -> {} (backup: {})", + "renamed {} -> {} (backup: {})", from.quote(), to.quote(), path.quote() ), - None => format!("{} -> {}", from.quote(), to.quote()), + None => format!("renamed {} -> {}", from.quote(), to.quote()), }; match multi_progress { diff --git a/tests/by-util/test_mv.rs b/tests/by-util/test_mv.rs index 034234107..e4064e68a 100644 --- a/tests/by-util/test_mv.rs +++ b/tests/by-util/test_mv.rs @@ -745,7 +745,9 @@ fn test_mv_backup_dir() { .arg(dir_a) .arg(dir_b) .succeeds() - .stdout_only(format!("'{dir_a}' -> '{dir_b}' (backup: '{dir_b}~')\n")); + .stdout_only(format!( + "renamed '{dir_a}' -> '{dir_b}' (backup: '{dir_b}~')\n" + )); assert!(!at.dir_exists(dir_a)); assert!(at.dir_exists(dir_b)); @@ -817,7 +819,7 @@ fn test_mv_verbose() { .arg(file_a) .arg(file_b) .succeeds() - .stdout_only(format!("'{file_a}' -> '{file_b}'\n")); + .stdout_only(format!("renamed '{file_a}' -> '{file_b}'\n")); at.touch(file_a); scene @@ -826,7 +828,9 @@ fn test_mv_verbose() { .arg(file_a) .arg(file_b) .succeeds() - .stdout_only(format!("'{file_a}' -> '{file_b}' (backup: '{file_b}~')\n")); + .stdout_only(format!( + "renamed '{file_a}' -> '{file_b}' (backup: '{file_b}~')\n" + )); } #[test]