From 86ef34e908028198fc48868fda21df7b0a24e2d8 Mon Sep 17 00:00:00 2001 From: amtoine Date: Sun, 19 Feb 2023 12:09:50 +0100 Subject: [PATCH] add a key-value example to `with-env` --- crates/nu-command/src/env/with_env.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/nu-command/src/env/with_env.rs b/crates/nu-command/src/env/with_env.rs index 658a3ad9c..1914eab12 100644 --- a/crates/nu-command/src/env/with_env.rs +++ b/crates/nu-command/src/env/with_env.rs @@ -62,6 +62,11 @@ impl Command for WithEnv { example: r#"with-env [[X W]; [Y Z]] { $env.W }"#, result: Some(Value::test_string("Z")), }, + Example { + description: "Set by key-value record", + example: r#"with-env {X: "Y", W: "Z"} { [$env.X $env.W] }"#, + result: None, + }, Example { description: "Set by row(e.g. `open x.json` or `from json`)", example: r#"'{"X":"Y","W":"Z"}'|from json|with-env $in { [$env.X $env.W] }"#,