Introduce metadata into the pipeline (#397)

This commit is contained in:
JT
2021-12-02 18:59:10 +13:00
committed by GitHub
parent 56307553ae
commit 45eba8b922
28 changed files with 329 additions and 199 deletions

View File

@ -147,7 +147,7 @@ mod test {
assert!(call.has_flag("flag"));
let required: f64 = call.req(0).unwrap();
assert_eq!(required, 1.0);
assert!((required - 1.0).abs() < f64::EPSILON);
let optional: Option<String> = call.opt(1).unwrap();
assert_eq!(optional, Some("something".to_string()));

View File

@ -145,8 +145,8 @@ impl Command for PluginDeclaration {
})?;
let input = match input {
PipelineData::Value(value) => value,
PipelineData::Stream(stream) => {
PipelineData::Value(value, ..) => value,
PipelineData::Stream(stream, ..) => {
let values = stream.collect::<Vec<Value>>();
Value::List {
@ -192,7 +192,9 @@ impl Command for PluginDeclaration {
})?;
match response {
PluginResponse::Value(value) => Ok(PipelineData::Value(value.as_ref().clone())),
PluginResponse::Value(value) => {
Ok(PipelineData::Value(value.as_ref().clone(), None))
}
PluginResponse::Error(msg) => Err(ShellError::LabeledError(
"Error received from plugin".into(),
msg,