mirror of
https://github.com/nushell/nushell.git
synced 2024-11-22 08:23:24 +01: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
@ -15,7 +15,7 @@ use nu_path::expand_path_with;
|
|||||||
use nu_plugin::{EngineInterface, EvaluatedCall, PluginCommand};
|
use nu_plugin::{EngineInterface, EvaluatedCall, PluginCommand};
|
||||||
use nu_protocol::{
|
use nu_protocol::{
|
||||||
Category, Example, LabeledError, PipelineData, ShellError, Signature, Span, Spanned,
|
Category, Example, LabeledError, PipelineData, ShellError, Signature, Span, Spanned,
|
||||||
SyntaxShape, Type, Value,
|
SyntaxShape, Type,
|
||||||
};
|
};
|
||||||
use polars::error::PolarsError;
|
use polars::error::PolarsError;
|
||||||
|
|
||||||
@ -209,12 +209,8 @@ fn command(
|
|||||||
span: spanned_file.span,
|
span: spanned_file.span,
|
||||||
}),
|
}),
|
||||||
}?;
|
}?;
|
||||||
let file_value = Value::string(format!("saved {:?}", &file_path), file_span);
|
|
||||||
|
|
||||||
Ok(PipelineData::Value(
|
Ok(PipelineData::empty())
|
||||||
Value::list(vec![file_value], call.head),
|
|
||||||
None,
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn polars_file_save_error(e: PolarsError, span: Span) -> ShellError {
|
pub(crate) fn polars_file_save_error(e: PolarsError, span: Span) -> ShellError {
|
||||||
@ -264,16 +260,10 @@ pub(crate) mod test {
|
|||||||
Span::test_data(),
|
Span::test_data(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
let pipeline_data = plugin_test.eval(&cmd)?;
|
let _pipeline_data = plugin_test.eval(&cmd)?;
|
||||||
|
|
||||||
assert!(tmp_file.exists());
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,19 +280,4 @@ pub(crate) mod test {
|
|||||||
extension,
|
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 New Issue
Block a user