rename nushell's cp command to cp-old making coreutils the default cp (#10678)

# Description

This PR renames nushell's `cp` command to `cp-old` to make room for
`ucp` to be renamed to `cp`, making the coreutils version of `cp` the
default for nushell. After some period of time, we should remove
`cp-old` entirely.

# 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:

- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to
check that you're using the standard code style
- `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))
- `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
<!-- If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
-->
This commit is contained in:
Darren Schroeder
2023-10-10 18:13:28 -05:00
committed by GitHub
parent c81fa397b6
commit 0ba81f1d51
6 changed files with 60 additions and 71 deletions

View File

@ -31,11 +31,11 @@ pub struct Cp;
impl Command for Cp {
fn name(&self) -> &str {
"cp"
"cp-old"
}
fn usage(&self) -> &str {
"Copy files."
"Old nushell version of Copy files."
}
fn search_terms(&self) -> Vec<&str> {
@ -43,7 +43,7 @@ impl Command for Cp {
}
fn signature(&self) -> Signature {
Signature::build("cp")
Signature::build("cp-old")
.input_output_types(vec![(Type::Nothing, Type::Nothing)])
.required("source", SyntaxShape::GlobPattern, "the place to copy from")
.required("destination", SyntaxShape::Filepath, "the place to copy to")

View File

@ -27,7 +27,7 @@ pub struct UCp;
impl Command for UCp {
fn name(&self) -> &str {
"ucp"
"cp"
}
fn usage(&self) -> &str {
@ -39,7 +39,7 @@ impl Command for UCp {
}
fn signature(&self) -> Signature {
Signature::build("ucp")
Signature::build("cp")
.input_output_types(vec![(Type::Nothing, Type::Nothing)])
.switch("recursive", "copy directories recursively", Some('r'))
.switch("verbose", "explicitly state what is being done", Some('v'))
@ -63,22 +63,22 @@ impl Command for UCp {
vec![
Example {
description: "Copy myfile to dir_b",
example: "ucp myfile dir_b",
example: "cp myfile dir_b",
result: None,
},
Example {
description: "Recursively copy dir_a to dir_b",
example: "ucp -r dir_a dir_b",
example: "cp -r dir_a dir_b",
result: None,
},
Example {
description: "Recursively copy dir_a to dir_b, and print the feedbacks",
example: "ucp -r -v dir_a dir_b",
example: "cp -r -v dir_a dir_b",
result: None,
},
Example {
description: "Move many files into a directory",
example: "ucp *.txt dir_a",
example: "cp *.txt dir_a",
result: None,
},
]