Move $nu.env to $env (#665)

* Move env from nu builtin to its own

* update samples/tests
This commit is contained in:
JT
2022-01-05 08:34:42 +11:00
committed by GitHub
parent 4d1ce6c27b
commit 8f6843c600
11 changed files with 95 additions and 80 deletions

View File

@ -48,22 +48,22 @@ impl Command for WithEnv {
vec![
Example {
description: "Set the MYENV environment variable",
example: r#"with-env [MYENV "my env value"] { $nu.env.MYENV }"#,
example: r#"with-env [MYENV "my env value"] { $env.MYENV }"#,
result: Some(Value::test_string("my env value")),
},
Example {
description: "Set by primitive value list",
example: r#"with-env [X Y W Z] { $nu.env.X }"#,
example: r#"with-env [X Y W Z] { $env.X }"#,
result: Some(Value::test_string("Y")),
},
Example {
description: "Set by single row table",
example: r#"with-env [[X W]; [Y Z]] { $nu.env.W }"#,
example: r#"with-env [[X W]; [Y Z]] { $env.W }"#,
result: Some(Value::test_string("Z")),
},
Example {
description: "Set by row(e.g. `open x.json` or `from json`)",
example: r#"echo '{"X":"Y","W":"Z"}'|from json|with-env $it { echo $nu.env.X $nu.env.W }"#,
example: r#"echo '{"X":"Y","W":"Z"}'|from json|with-env $it { echo $env.X $env.W }"#,
result: None,
},
]