mirror of
https://github.com/nushell/nushell
synced 2024-11-15 17:27:58 +00:00
add a key-value example to with-env
This commit is contained in:
parent
f3ee8b50e3
commit
86ef34e908
1 changed files with 5 additions and 0 deletions
5
crates/nu-command/src/env/with_env.rs
vendored
5
crates/nu-command/src/env/with_env.rs
vendored
|
@ -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] }"#,
|
||||||
|
|
Loading…
Reference in a new issue