diff --git a/crates/nu-command/src/core_commands/do_.rs b/crates/nu-command/src/core_commands/do_.rs index b7f6a9ee08..2aaadf0df2 100644 --- a/crates/nu-command/src/core_commands/do_.rs +++ b/crates/nu-command/src/core_commands/do_.rs @@ -183,6 +183,11 @@ impl Command for Do { example: r#"do { echo hello }"#, result: Some(Value::test_string("hello")), }, + Example { + description: "Run a stored first-class closure", + example: r#"let text = "I am enclosed"; let hello = {|| echo $text}; do $hello"#, + result: Some(Value::test_string("I am enclosed")), + }, Example { description: "Run the closure and ignore both shell and external program errors", example: r#"do -i { thisisnotarealcommand }"#,