add a key-value example to with-env

This commit is contained in:
amtoine 2023-02-19 12:09:50 +01:00
parent f3ee8b50e3
commit 86ef34e908
No known key found for this signature in database
GPG key ID: 37AAE9B486CFF1AB

View file

@ -62,6 +62,11 @@ impl Command for WithEnv {
example: r#"with-env [[X W]; [Y Z]] { $env.W }"#, example: r#"with-env [[X W]; [Y Z]] { $env.W }"#,
result: Some(Value::test_string("Z")), 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 { Example {
description: "Set by row(e.g. `open x.json` or `from json`)", 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] }"#, example: r#"'{"X":"Y","W":"Z"}'|from json|with-env $in { [$env.X $env.W] }"#,