Skip to content

Commit

Permalink
Replaced export to run-external
Browse files Browse the repository at this point in the history
  • Loading branch information
cvanelteren committed Jul 31, 2023
1 parent 412c8a6 commit b3cc923
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
19 changes: 7 additions & 12 deletions libmamba/data/mamba.nu
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@

export def micromamba [...arg] {
let cmd = $arg.0
let argv = if ( $arg.1? == null ) { "" } else { $arg.1 }

if ($cmd in [ activate deactivate ]) {
exec $env.MAMBA_EXE $cmd $argv
#!/usr/bin/env nu
def-env micromamba [...cmd] {
let reactivate = [update upgrade remove uninstall]
if ($cmd.0 in reactivate) {
run-external $env.MAMBA_EXE $cmd;
run-external $env.MAMBA_EXE reactivate;
}
elif ($cmd in [update upgrade remove uninstall]) {
exec $env.MAMBA_EXE $cmd $argv
exec $env.MAMBA_EXE reactivate
}
else {
$env.MAMBA_EXE $cmd $arg
run-external $env.MAMBA_EXE $cmd;
}
}

Expand Down
4 changes: 2 additions & 2 deletions libmamba/src/core/shell_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
//
// The full license is in the file LICENSE, distributed with this software.

#include <iostream>
#include <regex>
#include <set>
#include <stdexcept>
Expand Down Expand Up @@ -410,7 +409,7 @@ namespace mamba
content << "# !! Contents within this block are managed by 'mamba init' !!\n";
content << "$env.MAMBA_EXE = " << mamba_exe << "\n";
content << "$env.MAMBA_ROOT_PREFIX = " << env_prefix << "\n";
content << "exec $env.MAMBA_EXE shell hook --shell nu --root-prefix $env.MAMBA_ROOT_PREFIX\n";
content << "run-external $env.MAMBA_EXE 'shell' 'hook' '--shell' 'nu' '--root-prefix' $env.MAMBA_ROOT_PREFIX --redirect-stdout \n";
content << "$env.PATH = ($env.PATH | append ( [$env.MAMBA_ROOT_PREFIX bin] | path join)) \n";
content << "# <<< mamba initialize <<<\n";
return content.str();
Expand Down Expand Up @@ -610,6 +609,7 @@ namespace mamba
replace_all(contents, "$MAMBA_EXE", exe.string());
return contents;
}
// deprecated according to https://github.com/mamba-org/mamba/pull/2693
else if (shell == "nu")
{
std::string contents = data_mamba_nu;
Expand Down
2 changes: 1 addition & 1 deletion micromamba/src/activate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ set_activate_command(CLI::App* subcom)
"Otherwise, this may be an issue. In the meantime you can run commands. See:\n"
" $ micromamba run --help\n"
"\n"
"Supported shells are {{bash, zsh, csh, xonsh, cmd.exe, powershell, fish}}.\n",
"Supported shells are {{bash, zsh, csh, xonsh, cmd.exe, powershell, fish, nu}}.\n",
get_shell_hook(guessed_shell),
guessed_shell
);
Expand Down

0 comments on commit b3cc923

Please sign in to comment.