diff --git a/crates/nu-command/tests/format_conversions/html.rs b/crates/nu-command/tests/format_conversions/html.rs
index 1fdf41bbdc..9a1e18c6a2 100644
--- a/crates/nu-command/tests/format_conversions/html.rs
+++ b/crates/nu-command/tests/format_conversions/html.rs
@@ -57,7 +57,7 @@ fn test_cd_html_color_flag_dark_false() {
);
assert_eq!(
actual.out,
- r"
Change directory.
Usage:
> cd (path)
Flags:
-h, --help
Display the help message for this command
Parameters:
(optional) path <directory>: the path to change to
Examples:
Change to your home directory
> cd ~
Change to a directory via abbreviations
> cd d/s/9
Change to the previous working directory ($OLDPWD)
> cd -
"
+ r"Change directory.
Usage:
> cd (path)
Flags:
-h, --help - Display the help message for this command
Signatures:
<nothing> | cd <string?> -> <nothing>
<string> | cd <string?> -> <nothing>
Parameters:
(optional) path <directory>: the path to change to
Examples:
Change to your home directory
> cd ~
Change to a directory via abbreviations
> cd d/s/9
Change to the previous working directory ($OLDPWD)
> cd -
"
);
}
diff --git a/crates/nu-engine/src/documentation.rs b/crates/nu-engine/src/documentation.rs
index cdd5b82986..cec962e30a 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;
@@ -209,6 +209,32 @@ fn get_documentation(
} else {
let _ = write!(long_desc, "\n > {}\n", example.example);
}
+
+ if let Some(result) = &example.result {
+ let table = engine_state
+ .find_decl("table".as_bytes(), &[])
+ .and_then(|decl_id| {
+ engine_state
+ .get_decl(decl_id)
+ .run(
+ engine_state,
+ stack,
+ &Call::new(Span::new(0, 0)),
+ PipelineData::Value(result.clone(), None),
+ )
+ .ok()
+ });
+
+ for item in table.into_iter().flatten() {
+ let _ = writeln!(
+ long_desc,
+ " {}",
+ item.into_string("", engine_state.get_config())
+ .replace('\n', "\n ")
+ .trim()
+ );
+ }
+ }
}
long_desc.push('\n');
diff --git a/src/tests/test_engine.rs b/src/tests/test_engine.rs
index a8f7da2564..c47d559821 100644
--- a/src/tests/test_engine.rs
+++ b/src/tests/test_engine.rs
@@ -53,7 +53,7 @@ fn in_and_if_else() -> TestResult {
#[test]
fn help_works_with_missing_requirements() -> TestResult {
- run_test(r#"each --help | lines | length"#, "43")
+ run_test(r#"each --help | lines | length"#, "65")
}
#[test]