Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update shell_init for nushell #3771

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
6 changes: 3 additions & 3 deletions libmamba/src/core/activation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1248,7 +1248,7 @@ namespace mamba

if (!env_transform.export_path.empty())
{
out << "PATH = " << env_transform.export_path << ";";
out << "PATH = " << env_transform.export_path << util:on_win ? ';' : ':';
}

for (const fs::u8path& ds : env_transform.deactivate_scripts)
Expand All @@ -1268,9 +1268,9 @@ namespace mamba

for (const auto& [ekey, evar] : env_transform.export_vars)
{
out << ekey << " = " << evar << ";";
// add unix or windows handling
out << ekey << " = " << evar << util:on_win ? ';' : ':';
}

for (const fs::u8path& p : env_transform.activate_scripts)
{
out << "source " << p << ";";
Expand Down
5 changes: 3 additions & 2 deletions libmamba/src/core/shell_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,12 +497,13 @@ namespace mamba
#ask mamba how to setup the environment and set the environment
(^($env.MAMBA_EXE) shell activate --shell nu $name
| str replace --regex '\s+' '' --all
| split row ";"
| split row (if $nu.os-info.name == "windows" { ";" } else { ":" })
| parse --regex '(.*)=(.+)'
| transpose --header-row
| into record
| load-env
)
$env.PATH = $env.PATH | split row (char esep)
# update prompt
if ($env.CONDA_PROMPT_MODIFIER? != null) {
$env.PROMPT_COMMAND = {|| $env.CONDA_PROMPT_MODIFIER + (do $env.PROMPT_COMMAND_BK)}
Expand All @@ -515,7 +516,7 @@ namespace mamba
if $env.CONDA_PROMPT_MODIFIER? != null {
# unset set variables
for x in (^$env.MAMBA_EXE shell deactivate --shell nu
| split row ";") {
| split row (if $nu.os-info.name == "windows" { ";" } else { ";" }) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be (if $nu.os-info.name == "windows" { ";" } else { ":" })?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't the separator ; on windows?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yah, but the else part, it should be :, I guess line 519 should be the same as line 500

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right you are correct ;-) Fixed!

if ("hide-env" in $x) {
hide-env ($x | parse "hide-env {var}").var.0
} else if $x != "" {
Expand Down