Add env-conversions helpers to std (#15569)

When combined with [the Cookbook
update](https://github.com/nushell/nushell.github.io/pull/1878), this
resolves #15452

# Description

When we removed the startup `ENV_CONVERSION` for path, as noted in the
issue above, we removed the ability for users to access this closure for
other purposes. This PR adds the PATH closures back as a `std` commands
that outputs a record of closures (similar to `ENV_CONVERSIONS`).

# User-Facing Changes

Doc will be updated and users can once again easily access `direnv`

# Tests + Formatting

- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`

# After Submitting

Doc PR to be merged when released in 0.104
This commit is contained in:
Douglas 2025-04-21 19:22:46 -04:00 committed by GitHub
parent 03d455a688
commit a9657e17ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -133,3 +133,13 @@ export def light-theme [] {
shape_raw_string: light_purple
}
}
# Returns helper closures that can be used for ENV_CONVERSIONS and other purposes
export def env-conversions [] {
{
"path": {
from_string: {|s| $s | split row (char esep) | path expand --no-symlink }
to_string: {|v| $v | path expand --no-symlink | str join (char esep) }
}
}
}