Files
pickx 7b893cbad5 roundup of fixes for {hide,load,with}-env (#19098)
## Description
this is a roundup of fixes meant to address the following issues:
1. `$env.config`
- `load-env { config: {} }` and `hide-env config` can make `$env.config`
inaccessible. with the way nushell works, the config isn't gone, and a
simple `$env.config = {}` will fix this. but (imo) it's still weird.
- it can also give the impression that `load-env` is able to set
`$env.config`, which it couldn't.
    - therefore, I changed it so `hide-env` can't touch `config`.
- meanwhile, `load-env` and `with-env` (including the shorthand syntax
`FOO=bar command`) can now change `config`, which triggers a proper
config reload
2. automatic env vars
- automatic env vars like `PWD` are not supposed to be changed through
`load-env` and `hide-env`. a guard was implemented in `load-env` but not
`hide-env`. now both handle this.
- we had several manual impls of finding automatic env vars. changed to
use a shared impl.
- some env var-detecting logic still has the assumption that env vars
are case sensitive outside Windows, but `load-env` and `hide-env` don't
work like that. so although `load-env` tried to guard against changing
e.g. `$env.PWD` it would happily change `$env.PwD` so can still mess up
the environment.

## User-facing changes (Release notes)
Changes have been made around the interaction of `load-env`, `hide-env`
and `with-env` with some environment variables which are managed by
nushell.

Specifically:
* `load-env`, `hide-env` and `with-env` can no longer change `$env.PWD`,
regardless of casing (for example, `Pwd` is also rejected).
* `hide-env` can no longer hide `$env.FILE_PWD` or `$env.CURRENT_FILE`.
this was previously allowed.
* `load-env` and `with-env`, including the syntax `FOO=bar command`, can
now set `$env.config`.
* `hide-env` can no longer hide `$env.config`.
2026-10-17 07:13:58 -05:00
..