Skip to content

Commit d0627a0

Browse files
committed
Section on stricter env rules
1 parent 0a653a5 commit d0627a0

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

blog/2024-04-30-nushell_0_93_0.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ As part of this release, we also publish a set of optional plugins you can insta
2929
- [*Hall of fame*](#hall-of-fame-toc)
3030
- [*Bug fixes*](#bug-fixes-toc)
3131
- [*Enhancing the documentation*](#enhancing-the-documentation-toc)
32+
- [*Stricter rules around setting environment variables*](#stricter-rules-around-setting-environment-variables-toc)
3233
- [*Our set of commands is evolving*](#our-set-of-commands-is-evolving-toc)
3334
- [*New commands*](#new-commands-toc)
3435
- [*Changes to existing commands*](#changes-to-existing-commands-toc)
@@ -92,6 +93,35 @@ Thanks to all the contributors below for helping us making the documentation of
9293
| ------------------------------------ | ----------- | ------------------------------------------------------- |
9394
| [@author](https://github.com/author) | ... | [#12345](https://github.com/nushell/nushell/pull/12345) |
9495

96+
## Stricter rules around setting environment variables [[toc](#table-of-content)]
97+
98+
::: warning Breaking change
99+
See a full overview of the [breaking changes](#breaking-changes-toc)
100+
:::
101+
102+
The setting of environment variables via the following ways:
103+
- `$env.VAR_NAME = ...` assignment
104+
- scopes with the `with-env` command
105+
- the short hand syntax `FOO=bar command-to-run`
106+
- the `load-env` command
107+
108+
will now consistently prohibit you from changing a set of special environment variables controlled by Nushell.
109+
Currently this is the following set (already valid for `$env.` assignment):
110+
- `$env.PWD`
111+
- `$env.FILE_PWD`
112+
- `$env.CURRENT_FILE`
113+
This set may be expanded by future breaking changes to ensure consistent semantics of those special variables
114+
115+
Furthermore the `FOO=bar BAZ=bla command` shorthand syntax to set an environment variable for the scope of one command is now stricter.
116+
It will disallow you from repeating the same environment variable name twice and instead return an error ([#12523](https://github.com/nushell/nushell/pull/12523)).
117+
118+
```nushell
119+
# Now raises an error
120+
FOO=bar FOO=bla command
121+
```
122+
123+
Additionally, we standardize on using records to pass a map of environment variables to the `with-env` command, and thus [deprecate the other previously allowed forms with this release](#with-env-toc).
124+
95125
## Our set of commands is evolving [[toc](#table-of-content)]
96126

97127
### New commands [[toc](#table-of-content)]

0 commit comments

Comments
 (0)