mirror of
https://github.com/nushell/nushell.git
synced 2025-08-12 07:19:12 +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:
@ -660,7 +660,7 @@ Operating system commands:
|
||||
let ctrlc = engine_state.ctrlc.clone();
|
||||
|
||||
if list {
|
||||
return generate_ansi_code_list(ctrlc, call.head, use_ansi_coloring);
|
||||
return Ok(generate_ansi_code_list(ctrlc, call.head, use_ansi_coloring));
|
||||
}
|
||||
|
||||
// The code can now be one of the ansi abbreviations like green_bold
|
||||
@ -694,7 +694,7 @@ Operating system commands:
|
||||
let ctrlc = working_set.permanent().ctrlc.clone();
|
||||
|
||||
if list {
|
||||
return generate_ansi_code_list(ctrlc, call.head, use_ansi_coloring);
|
||||
return Ok(generate_ansi_code_list(ctrlc, call.head, use_ansi_coloring));
|
||||
}
|
||||
|
||||
// The code can now be one of the ansi abbreviations like green_bold
|
||||
@ -833,8 +833,8 @@ fn generate_ansi_code_list(
|
||||
ctrlc: Option<Arc<AtomicBool>>,
|
||||
call_span: Span,
|
||||
use_ansi_coloring: bool,
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
return Ok(CODE_LIST
|
||||
) -> PipelineData {
|
||||
CODE_LIST
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(move |(i, ansi_code)| {
|
||||
@ -865,7 +865,7 @@ fn generate_ansi_code_list(
|
||||
|
||||
Value::record(record, call_span)
|
||||
})
|
||||
.into_pipeline_data(ctrlc));
|
||||
.into_pipeline_data(call_span, ctrlc)
|
||||
}
|
||||
|
||||
fn build_ansi_hashmap(v: &[AnsiCode]) -> HashMap<&str, &str> {
|
||||
|
Reference in New Issue
Block a user