Better error message for mv when file not found (#8586)

Closes #8546.

### Before:
```
> mv foo.txt bar.txt
Error:
  × Invalid file or pattern
   ╭─[entry #2:1:1]
 1 │ mv foo.txt bar.txt
   ·    ───┬───
   ·       ╰── invalid file or pattern
   ╰────
```

### After:
```
> mv foo.txt bar.txt
Error:
  × File(s) not found
   ╭─[entry #2:1:1]
 1 │ mv foo.txt bar.txt
   ·    ───┬───
   ·       ╰── could not find any files matching this glob pattern
   ╰────
```
This commit is contained in:
Reilly Wood 2023-03-23 11:31:49 -07:00 committed by GitHub
parent 35798ce0cc
commit 5c2a767987
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -87,8 +87,8 @@ impl Command for Mv {
if sources.is_empty() {
return Err(ShellError::GenericError(
"Invalid file or pattern".into(),
"invalid file or pattern".into(),
"File(s) not found".into(),
"could not find any files matching this glob pattern".into(),
Some(spanned_source.span),
None,
Vec::new(),

View file

@ -203,7 +203,7 @@ fn errors_if_source_doesnt_exist() {
cwd: dirs.test(),
"mv non-existing-file test_folder/"
);
assert!(actual.err.contains("invalid file or pattern"));
assert!(actual.err.contains("File(s) not found"));
})
}