mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 19:47:45 +00:00
cp: remove interactive mode message on 'no' (#4069)
This commit is contained in:
parent
14e9e910de
commit
1172a7e781
2 changed files with 5 additions and 15 deletions
|
@ -82,7 +82,7 @@ quick_error! {
|
||||||
StripPrefixError(err: StripPrefixError) { from() }
|
StripPrefixError(err: StripPrefixError) { from() }
|
||||||
|
|
||||||
/// Result of a skipped file
|
/// Result of a skipped file
|
||||||
Skipped(reason: String) { display("{}", reason) }
|
Skipped { }
|
||||||
|
|
||||||
/// Result of a skipped file
|
/// Result of a skipped file
|
||||||
InvalidArgument(description: String) { display("{}", description) }
|
InvalidArgument(description: String) { display("{}", description) }
|
||||||
|
@ -967,9 +967,7 @@ fn copy(sources: &[Source], target: &TargetSlice, options: &Options) -> CopyResu
|
||||||
// When using --no-clobber, we don't want to show
|
// When using --no-clobber, we don't want to show
|
||||||
// an error message
|
// an error message
|
||||||
Error::NotAllFilesCopied => (),
|
Error::NotAllFilesCopied => (),
|
||||||
Error::Skipped(_) => {
|
Error::Skipped => (),
|
||||||
show_error!("{}", error);
|
|
||||||
}
|
|
||||||
_ => {
|
_ => {
|
||||||
show_error!("{}", error);
|
show_error!("{}", error);
|
||||||
non_fatal_errors = true;
|
non_fatal_errors = true;
|
||||||
|
@ -1044,10 +1042,7 @@ impl OverwriteMode {
|
||||||
if prompt_yes!("{}: overwrite {}? ", uucore::util_name(), path.quote()) {
|
if prompt_yes!("{}: overwrite {}? ", uucore::util_name(), path.quote()) {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(Error::Skipped(format!(
|
Err(Error::Skipped)
|
||||||
"Not overwriting {} at user request",
|
|
||||||
path.quote()
|
|
||||||
)))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Self::Clobber(_) => Ok(()),
|
Self::Clobber(_) => Ok(()),
|
||||||
|
|
|
@ -232,15 +232,11 @@ fn test_cp_arg_interactive() {
|
||||||
let (at, mut ucmd) = at_and_ucmd!();
|
let (at, mut ucmd) = at_and_ucmd!();
|
||||||
at.touch("a");
|
at.touch("a");
|
||||||
at.touch("b");
|
at.touch("b");
|
||||||
// TODO The prompt in GNU cp is different, and it doesn't have the
|
|
||||||
// response either.
|
|
||||||
//
|
|
||||||
// See <https://github.com/uutils/coreutils/issues/4023>.
|
|
||||||
ucmd.args(&["-i", "a", "b"])
|
ucmd.args(&["-i", "a", "b"])
|
||||||
.pipe_in("N\n")
|
.pipe_in("N\n")
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.no_stdout()
|
.no_stdout()
|
||||||
.stderr_is("cp: overwrite 'b'? [y/N]: cp: Not overwriting 'b' at user request\n");
|
.stderr_is("cp: overwrite 'b'? [y/N]:");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -312,8 +308,7 @@ fn test_cp_arg_no_clobber_twice() {
|
||||||
.arg("--no-clobber")
|
.arg("--no-clobber")
|
||||||
.arg("source.txt")
|
.arg("source.txt")
|
||||||
.arg("dest.txt")
|
.arg("dest.txt")
|
||||||
.succeeds()
|
.succeeds();
|
||||||
.stdout_does_not_contain("Not overwriting");
|
|
||||||
|
|
||||||
assert_eq!(at.read("source.txt"), "some-content");
|
assert_eq!(at.read("source.txt"), "some-content");
|
||||||
// Should be empty as the "no-clobber" should keep
|
// Should be empty as the "no-clobber" should keep
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue