mirror of
https://github.com/nushell/nushell
synced 2024-11-10 07:04:13 +00:00
Make polars save
return an empty pipeline (#13833)
# Description In order to be more consistent with it's nu counterpart, `polars save` now returns an empty pipeline instead of a message of the saved file. # User-Facing Changes - `polars save` no longer displays a save message, making it consistent with `save` behavior.
This commit is contained in:
parent
1bcceafd93
commit
fb34a4fc6c
1 changed files with 3 additions and 28 deletions
|
@ -15,7 +15,7 @@ use nu_path::expand_path_with;
|
|||
use nu_plugin::{EngineInterface, EvaluatedCall, PluginCommand};
|
||||
use nu_protocol::{
|
||||
Category, Example, LabeledError, PipelineData, ShellError, Signature, Span, Spanned,
|
||||
SyntaxShape, Type, Value,
|
||||
SyntaxShape, Type,
|
||||
};
|
||||
use polars::error::PolarsError;
|
||||
|
||||
|
@ -209,12 +209,8 @@ fn command(
|
|||
span: spanned_file.span,
|
||||
}),
|
||||
}?;
|
||||
let file_value = Value::string(format!("saved {:?}", &file_path), file_span);
|
||||
|
||||
Ok(PipelineData::Value(
|
||||
Value::list(vec![file_value], call.head),
|
||||
None,
|
||||
))
|
||||
Ok(PipelineData::empty())
|
||||
}
|
||||
|
||||
pub(crate) fn polars_file_save_error(e: PolarsError, span: Span) -> ShellError {
|
||||
|
@ -264,16 +260,10 @@ pub(crate) mod test {
|
|||
Span::test_data(),
|
||||
),
|
||||
);
|
||||
let pipeline_data = plugin_test.eval(&cmd)?;
|
||||
let _pipeline_data = plugin_test.eval(&cmd)?;
|
||||
|
||||
assert!(tmp_file.exists());
|
||||
|
||||
let value = pipeline_data.into_value(Span::test_data())?;
|
||||
let list = value.as_list()?;
|
||||
assert_eq!(list.len(), 1);
|
||||
let msg = list.first().expect("should have a value").as_str()?;
|
||||
assert!(msg.contains("saved"));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -290,19 +280,4 @@ pub(crate) mod test {
|
|||
extension,
|
||||
)
|
||||
}
|
||||
|
||||
// #[test]
|
||||
// pub fn test_to_ipc() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// test_sink("ipc")
|
||||
// }
|
||||
//
|
||||
// #[test]
|
||||
// pub fn test_to_csv() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// test_sink("csv")
|
||||
// }
|
||||
//
|
||||
// #[test]
|
||||
// pub fn test_to_json() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// test_sink("ndjson")
|
||||
// }
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue