Auto-generate markdown command docs (#4451)

* Finish updating

* a couple improvements

* Update renames

* cleanup examples
This commit is contained in:
JT
2022-02-13 21:22:51 -05:00
committed by GitHub
parent 06f5affc0b
commit 8c0a2d3c15
478 changed files with 7676 additions and 8045 deletions

View File

@ -1,36 +1,39 @@
# with-env
---
title: with-env
layout: command
version: 0.59.0
---
Runs a block with an environment variable set.
## Usage
```shell
> with-env <variable> <block> {flags}
```
## Signature
```> with-env (variable) (block)```
## Parameters
* `<variable>` the environment variable to temporarily set
* `<block>` the block to run once the variable is set
## Flags
* -h, --help: Display this help message
- `variable`: the environment variable to temporarily set
- `block`: the block to run once the variable is set
## Examples
Set the MYENV environment variable
```shell
> with-env [MYENV "my env value"] { echo $nu.env.MYENV }
```
Set by primitive value list
Set the MYENV environment variable
```shell
> with-env [X Y W Z] { echo $nu.env.X $nu.env.W }
```
> with-env [MYENV "my env value"] { $env.MYENV }
```
Set by single row table
Set by primitive value list
```shell
> with-env [[X W]; [Y Z]] { echo $nu.env.X $nu.env.W }
```
> with-env [X Y W Z] { $env.X }
```
Set by row(e.g. `open x.json` or `from json`)
Set by single row table
```shell
> echo '{"X":"Y","W":"Z"}'|from json|with-env $it { echo $nu.env.X $nu.env.W }
```
> with-env [[X W]; [Y Z]] { $env.W }
```
Set by row(e.g. `open x.json` or `from json`)
```shell
> echo '{"X":"Y","W":"Z"}'|from json|with-env $it { echo $env.X $env.W }
```