mirror of
https://github.com/nushell/nushell.git
synced 2025-08-14 12:09:00 +02:00
ListStream
touchup (#12524)
# Description Does some misc changes to `ListStream`: - Moves it into its own module/file separate from `RawStream`. - `ListStream`s now have an associated `Span`. - This required changes to `ListStreamInfo` in `nu-plugin`. Note sure if this is a breaking change for the plugin protocol. - Hides the internals of `ListStream` but also adds a few more methods. - This includes two functions to more easily alter a stream (these take a `ListStream` and return a `ListStream` instead of having to go through the whole `into_pipeline_data(..)` route). - `map`: takes a `FnMut(Value) -> Value` - `modify`: takes a function to modify the inner stream.
This commit is contained in:
@ -87,7 +87,7 @@ impl Command for EachWhile {
|
||||
Err(_) => None,
|
||||
})
|
||||
.fuse()
|
||||
.into_pipeline_data(engine_state.ctrlc.clone()))
|
||||
.into_pipeline_data(head, engine_state.ctrlc.clone()))
|
||||
}
|
||||
PipelineData::ExternalStream { stdout: None, .. } => Ok(PipelineData::empty()),
|
||||
PipelineData::ExternalStream {
|
||||
@ -108,7 +108,7 @@ impl Command for EachWhile {
|
||||
}
|
||||
})
|
||||
.fuse()
|
||||
.into_pipeline_data(engine_state.ctrlc.clone()))
|
||||
.into_pipeline_data(head, engine_state.ctrlc.clone()))
|
||||
}
|
||||
// This match allows non-iterables to be accepted,
|
||||
// which is currently considered undesirable (Nov 2022).
|
||||
|
@ -108,7 +108,7 @@ impl Command for UpdateCells {
|
||||
columns,
|
||||
span: head,
|
||||
}
|
||||
.into_pipeline_data(engine_state.ctrlc.clone())
|
||||
.into_pipeline_data(head, engine_state.ctrlc.clone())
|
||||
.set_metadata(metadata))
|
||||
}
|
||||
}
|
||||
|
@ -238,10 +238,7 @@ fn format(
|
||||
}
|
||||
}
|
||||
|
||||
Ok(PipelineData::ListStream(
|
||||
ListStream::from_stream(list.into_iter(), None),
|
||||
None,
|
||||
))
|
||||
Ok(ListStream::new(list.into_iter(), head_span, engine_state.ctrlc.clone()).into())
|
||||
}
|
||||
// Unwrapping this ShellError is a bit unfortunate.
|
||||
// Ideally, its Span would be preserved.
|
||||
|
Reference in New Issue
Block a user