diff --git a/init/nushell.in b/init/nushell.in index 2ef8a0837..a1a5b44c4 100644 --- a/init/nushell.in +++ b/init/nushell.in @@ -29,7 +29,7 @@ def --env lmod-eval [script: string] { # Handle different value types if ($var_value | str starts-with 'r#') and ($var_value | str ends-with '#') { # Raw string value - extract the content - let content = ($var_value | str substring 3..(-2)) + let content = ($var_value | str substring 3..(-3)) load-env {$var_name: $content} } else if ($var_value | str starts-with '[') and ($var_value | str ends-with ']') { # Array/list value - convert raw strings to regular strings then parse diff --git a/shells/Nushell.lua b/shells/Nushell.lua index b19a164c4..f5e990bcf 100644 --- a/shells/Nushell.lua +++ b/shells/Nushell.lua @@ -115,7 +115,7 @@ function Nushell.expandVar(self, k, v, vType) -- Handle path-like variables by converting to nushell list format -- BUT: __LMOD_REF_COUNT_* variables are encoded strings, not actual paths - if (vType == "path" and not k:match("^__LMOD_REF_COUNT_")) then + if (vType == "path" and not k:match("^__LMOD_REF_COUNT_")) and k ~= "MODULEPATH" then lineA[#lineA + 1] = "$env." lineA[#lineA + 1] = k lineA[#lineA + 1] = " = [" diff --git a/src/tcl2lua.tcl b/src/tcl2lua.tcl index b5bd404a1..c50cf31b0 100755 --- a/src/tcl2lua.tcl +++ b/src/tcl2lua.tcl @@ -1293,6 +1293,9 @@ switch -regexp -- $g_shellName { ^(fish)$ { set g_shellType fish } + ^(nushell)$ { + set g_shellType nushell + } ^(cmake)$ { set g_shellType cmake }