Always report errors in cp (#6404)

This commit is contained in:
Reilly Wood 2022-08-24 10:39:28 -07:00 committed by GitHub
parent a43514deb2
commit 3f93dc2f1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -50,7 +50,7 @@ impl Command for Cp {
) )
.switch( .switch(
"verbose", "verbose",
"do copy in verbose mode (default:false)", "show successful copies in addition to failed copies (default:false)",
Some('v'), Some('v'),
) )
// TODO: add back in additional features // TODO: add back in additional features
@ -285,7 +285,11 @@ impl Command for Cp {
if verbose { if verbose {
Ok(result.into_iter().into_pipeline_data(ctrlc)) Ok(result.into_iter().into_pipeline_data(ctrlc))
} else { } else {
Ok(PipelineData::new(span)) // filter to only errors
Ok(result
.into_iter()
.filter(|v| matches!(v, Value::Error { .. }))
.into_pipeline_data(ctrlc))
} }
} }