From 3f93dc2f1dab82b7a80e20d5f54b08b33ff4563f Mon Sep 17 00:00:00 2001 From: Reilly Wood <26268125+rgwood@users.noreply.github.com> Date: Wed, 24 Aug 2022 10:39:28 -0700 Subject: [PATCH] Always report errors in `cp` (#6404) --- crates/nu-command/src/filesystem/cp.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/nu-command/src/filesystem/cp.rs b/crates/nu-command/src/filesystem/cp.rs index 1fa46e0b37..9a554897f6 100644 --- a/crates/nu-command/src/filesystem/cp.rs +++ b/crates/nu-command/src/filesystem/cp.rs @@ -50,7 +50,7 @@ impl Command for Cp { ) .switch( "verbose", - "do copy in verbose mode (default:false)", + "show successful copies in addition to failed copies (default:false)", Some('v'), ) // TODO: add back in additional features @@ -285,7 +285,11 @@ impl Command for Cp { if verbose { Ok(result.into_iter().into_pipeline_data(ctrlc)) } else { - Ok(PipelineData::new(span)) + // filter to only errors + Ok(result + .into_iter() + .filter(|v| matches!(v, Value::Error { .. })) + .into_pipeline_data(ctrlc)) } }