with-env for env
Runs a block with an environment variable set.
Signature
> with-env {flags} (variable) (block)
Parameters
variable: The environment variable to temporarily set.block: The block to run once the variable is set.
Input/output types:
| input | output |
|---|---|
| any | any |
Examples
Set by key-value record
> with-env {X: "Y", W: "Z"} { [$env.X $env.W] }
╭───┬───╮
│ 0 │ Y │
│ 1 │ Z │
╰───┴───╯