nushell/crates/nu-command/src/filesystem
David Matos 7827b1fb87
ucp: Change error when directory is specified but not recursive (#10609)
# Description
Closes #10537. Basically error message was unhelpful, and this temporary
measure adds back the nice previous nushell error message. Ideally, we
would like to add a more permanent solution mentioned in the issue
[comments](https://github.com/nushell/nushell/issues/10537#issuecomment-1743686122),
but since we want to have `ucp` as `cp` on new release, this is hackier
but way simpler so this fix should do it.

Only downside is that now behavior differs from `uutils` in the sense
that:
```
uutils:
> cp a foo/ bar
ls bar
# foo/a

nushell:
>ucp a foo/ bar
# directory error (not copied) ....
```
So, since its non fatal error, uutils copies a, but nushell errors out
with nothing copied. If we go to option 3 mentioned above, then we can
decide what we want to do, and perhaps continue on a non fatal error.


# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->

# Tests + Formatting
Don't forget to add tests that cover your changes.

Make sure you've run and fixed any issues with these commands:

- [X] `cargo fmt --all -- --check` to check standard code formatting
(`cargo fmt --all` applies these changes)
- [X] `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used`
to check that you're using the standard code style
- [X] `cargo test --workspace` to check that all tests pass (on Windows
make sure to [enable developer
mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging))
- [X] `cargo run -- -c "use std testing; testing run-tests --path
crates/nu-std"` to run the tests for the standard library

> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```

# After Submitting

---------

Co-authored-by: amtoine <stevan.antoine@gmail.com>
2023-10-06 18:59:46 +02:00
..
cd.rs Remove cd w/ abbreviations (#10588) 2023-10-03 10:51:46 +13:00
cp.rs Revert "Port command examples to long option" (#10597) 2023-10-04 09:41:13 +13:00
glob.rs glob with ../ prefix now works; (#10504) 2023-09-29 06:48:55 -05:00
ls.rs Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
mkdir.rs Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
mod.rs Remove cd w/ abbreviations (#10588) 2023-10-03 10:51:46 +13:00
mv.rs show the full directory / file path in "directory not found" error (#10430) 2023-09-26 17:38:58 +08:00
open.rs Making open case-insensitive to file extensions (#10451) 2023-09-29 17:20:59 +02:00
rm.rs Clean up trash support on Android (#10225) 2023-09-05 14:38:23 +02:00
save.rs Invert &Options to Option<&T> (#10315) 2023-09-13 07:00:58 +08:00
start.rs provide env to commands and try to start provided path (#10302) 2023-09-12 14:03:41 +02:00
touch.rs Document and critically review ShellError variants - Ep. 2 (#8326) 2023-03-06 11:31:07 +01:00
ucp.rs ucp: Change error when directory is specified but not recursive (#10609) 2023-10-06 18:59:46 +02:00
util.rs Fix cp -u/mv -u when the dst doesn't exist (#9662) 2023-07-12 18:12:59 +02:00
watch.rs show the full directory / file path in "directory not found" error (#10430) 2023-09-26 17:38:58 +08:00