Merge pull request #5555 from cakebaker/cp_adapt_omitting_dir_msg

cp: improve error msg if -r is not specified
This commit is contained in:
Sylvestre Ledru 2023-11-24 21:51:04 +01:00 committed by GitHub
commit 64d47730bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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,
) -> CopyResult<()> {
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

View file

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