From a9657e17ad70932209499c74759ffea72bb1728d Mon Sep 17 00:00:00 2001 From: Douglas <32344964+NotTheDr01ds@users.noreply.github.com> Date: Mon, 21 Apr 2025 19:22:46 -0400 Subject: [PATCH] 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 - :green_circle: `toolkit fmt` - :green_circle: `toolkit clippy` - :green_circle: `toolkit test` - :green_circle: `toolkit test stdlib` # After Submitting Doc PR to be merged when released in 0.104 --- crates/nu-std/std/config/mod.nu | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/nu-std/std/config/mod.nu b/crates/nu-std/std/config/mod.nu index ce4549d3be..e96da375fc 100644 --- a/crates/nu-std/std/config/mod.nu +++ b/crates/nu-std/std/config/mod.nu @@ -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) } + } + } +} \ No newline at end of file