1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 19:47:45 +00:00

cp: improve error msg if -r is not specified

This commit is contained in:
Daniel Hofstetter 2023-11-19 15:59:38 +01:00
parent 02dc6ee67e
commit 285e580b6e
2 changed files with 4 additions and 2 deletions

View file

@ -324,7 +324,7 @@ pub(crate) fn copy_directory(
source_in_command_line: bool, source_in_command_line: bool,
) -> CopyResult<()> { ) -> CopyResult<()> {
if !options.recursive { if !options.recursive {
return Err(format!("omitting directory {}", root.quote()).into()); return Err(format!("-r not specified; omitting directory {}", root.quote()).into());
} }
// if no-dereference is enabled and this is a symlink, copy it as a file // if no-dereference is enabled and this is a symlink, copy it as a file

View file

@ -131,7 +131,9 @@ fn test_cp_directory_not_recursive() {
.arg(TEST_COPY_TO_FOLDER) .arg(TEST_COPY_TO_FOLDER)
.arg(TEST_HELLO_WORLD_DEST) .arg(TEST_HELLO_WORLD_DEST)
.fails() .fails()
.stderr_contains("omitting directory"); .stderr_is(format!(
"cp: -r not specified; omitting directory '{TEST_COPY_TO_FOLDER}'\n"
));
} }
#[test] #[test]