mirror of
https://github.com/nushell/nushell.git
synced 2025-08-16 16:41:41 +02:00
Simplify cp command and allow multiple recursive copying (#1580)
* Better message error * Use custom canonicalize in FileStructure build * Better glob error in ls * Use custom canonicalize, remove some duplicate code in cd. * Enable recursive copying with patterns. * Change test to fit new error message * Test recursive with glob pattern * Show that not matches were found in cp * Fix typo in message error * Change old canonicalize usage, follow newest changes
This commit is contained in:
committed by
GitHub
parent
a16a91ede8
commit
2b0212880e
@ -40,7 +40,7 @@ fn error_if_attempting_to_copy_a_directory_to_another_directory() {
|
||||
);
|
||||
|
||||
assert!(actual.contains("../formats"));
|
||||
assert!(actual.contains("is a directory (not copied)"));
|
||||
assert!(actual.contains("resolves to a directory (not copied)"));
|
||||
});
|
||||
}
|
||||
|
||||
@ -209,7 +209,7 @@ fn copy_files_using_glob_two_parents_up_using_multiple_dots() {
|
||||
"jonathan.json",
|
||||
"andres.xml",
|
||||
"kevin.txt",
|
||||
"many_more.ppl"
|
||||
"many_more.ppl",
|
||||
],
|
||||
dirs.test()
|
||||
));
|
||||
@ -217,20 +217,21 @@ fn copy_files_using_glob_two_parents_up_using_multiple_dots() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn copy_file_from_two_parents_up_using_multiple_dots_to_current_dir() {
|
||||
fn copy_file_and_dir_from_two_parents_up_using_multiple_dots_to_current_dir_recursive() {
|
||||
Playground::setup("cp_test_10", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![EmptyFile("hello_there")]);
|
||||
sandbox.mkdir("hello_again");
|
||||
sandbox.within("foo").mkdir("bar");
|
||||
|
||||
nu!(
|
||||
cwd: dirs.test().join("foo/bar"),
|
||||
r#"
|
||||
cp .../hello_there .
|
||||
cp -r .../hello* .
|
||||
"#
|
||||
);
|
||||
|
||||
let expected = dirs.test().join("foo/bar/hello_there");
|
||||
let expected = dirs.test().join("foo/bar");
|
||||
|
||||
assert!(expected.exists());
|
||||
assert!(files_exist_at(vec!["hello_there", "hello_again"], expected));
|
||||
})
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ fn fails_when_glob_doesnt_match() {
|
||||
"ls root3*"
|
||||
);
|
||||
|
||||
assert!(actual.contains("invalid file or pattern"));
|
||||
assert!(actual.contains("no matches found"));
|
||||
})
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user