From d2633cc59b48ccb227340e4cf66d0c2433b1d11f Mon Sep 17 00:00:00 2001 From: amtoine Date: Fri, 24 Feb 2023 10:14:32 +0100 Subject: [PATCH] use `PipelineData::Value::print` to print the `Value`s For now, the result is the same as the output of the commands but piped into `str join "\n"`! Progress is being made... --- crates/nu-engine/src/documentation.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/crates/nu-engine/src/documentation.rs b/crates/nu-engine/src/documentation.rs index fe7fbf26c1..fb9a8c3fd5 100644 --- a/crates/nu-engine/src/documentation.rs +++ b/crates/nu-engine/src/documentation.rs @@ -1,7 +1,7 @@ use nu_protocol::{ ast::Call, engine::{EngineState, Stack}, - Example, IntoPipelineData, Signature, Span, SyntaxShape, Value, + Example, IntoPipelineData, PipelineData, Signature, Span, SyntaxShape, Value, }; use std::fmt::Write; @@ -213,7 +213,13 @@ fn get_documentation( match &example.result { Some(result) => { - let _ = write!(long_desc, " {}\n", result.into_string(" ", engine_state.get_config())); + for item in PipelineData::Value(result.clone(), None) { + let _ = write!( + long_desc, + "{}\n", + item.into_string("\n", engine_state.get_config()) + ); + } } None => { let _ = write!(long_desc, " {WD}...{RESET}\n");