mirror of
https://github.com/nushell/nushell.git
synced 2025-08-16 11:47:53 +02:00
Fixed mv not throwing error when the source path was invalid (#1351)
* Fixed mv not throwing error when the source path was invalid * Fixed failing test * Fixed another lint error * Fix $PATH conflicts in .gitpod.Dockerfile (#1349) - Use the correct user for gitpod Dockerfile. - Remove unneeded packages (curl, rustc) from gitpod Dockerfile. * Added test to check for the error * Fixed linting error * Fixed mv not moving files on Windows. (#1342) Move files correctly in windows. * Fixed mv not throwing error when the source path was invalid * Fixed failing test * Fixed another lint error * Added test to check for the error * Fixed linting error * Changed error message * Typo and fixed test Co-authored-by: Sean Hellum <seanhellum45@gmail.com>
This commit is contained in:
committed by
GitHub
parent
ed86b1fbe8
commit
643b532537
@ -546,6 +546,13 @@ impl Shell for FilesystemShell {
|
||||
}
|
||||
};
|
||||
|
||||
if sources.is_empty() {
|
||||
return Err(ShellError::labeled_error(
|
||||
"Invalid File or Pattern.",
|
||||
"Invalid File or Pattern",
|
||||
src.tag,
|
||||
));
|
||||
}
|
||||
let destination_file_name = {
|
||||
match destination.file_name() {
|
||||
Some(name) => PathBuf::from(name),
|
||||
@ -559,6 +566,14 @@ impl Shell for FilesystemShell {
|
||||
}
|
||||
};
|
||||
|
||||
if sources.is_empty() {
|
||||
return Err(ShellError::labeled_error(
|
||||
"Move aborted. Not a valid destination",
|
||||
"not a valid destination",
|
||||
src.tag,
|
||||
));
|
||||
}
|
||||
|
||||
if sources.len() == 1 {
|
||||
if let Ok(entry) = &sources[0] {
|
||||
let entry_file_name = match entry.file_name() {
|
||||
|
Reference in New Issue
Block a user