Skip to content

Commit

Permalink
Adapt calls to micromamba shell
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoinePrv committed May 15, 2023
1 parent 00e3282 commit 4a4d544
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion libmamba/data/Mamba.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function Exit-MambaEnvironment {
if ($deactivateCommand.Trim().Length -eq 0) {
return;
}
Write-Verbose "[micromamba shell deactivate -s powershell]`n$deactivateCommand";
Write-Verbose "[micromamba shell deactivate --shell powershell]`n$deactivateCommand";
Invoke-Expression -Command $deactivateCommand;
}
process {}
Expand Down
2 changes: 1 addition & 1 deletion libmamba/data/_mamba_activate.bat
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@ECHO Failed to create temp directory "%TMP%\conda-<RANDOM>\" & exit /b 1
:tmp_file_created

@"%MAMBA_EXE%" shell --shell cmd.exe %* 1>%UNIQUE%
@"%MAMBA_EXE%" shell %1 --shell cmd.exe %*:~1% 1>%UNIQUE%
@IF %ErrorLevel% NEQ 0 @EXIT /B %ErrorLevel%
@FOR /F %%i IN (%UNIQUE%) DO @SET _TEMP_SCRIPT_PATH=%%i
@RMDIR /S /Q %UNIQUE_DIR%
Expand Down
4 changes: 2 additions & 2 deletions libmamba/data/mamba.fish
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ function micromamba --inherit-variable MAMBA_EXE
set -e argv[1]
switch $cmd
case activate deactivate
$MAMBA_EXE shell -s fish $cmd $argv | source || return $status
$MAMBA_EXE shell $cmd --shell fish $argv | source || return $status
case install update upgrade remove uninstall
$MAMBA_EXE $cmd $argv || return $status
$MAMBA_EXE shell -s fish reactivate | source || return $status
$MAMBA_EXE shell reactivate --shell fish | source || return $status
case '*'
$MAMBA_EXE $cmd $argv
end
Expand Down
6 changes: 3 additions & 3 deletions libmamba/data/micromamba.csh
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ if ("`alias micromamba`" == "") then
else
switch ( "${1}" )
case "activate":
set ask_conda="`(setenv prompt '${prompt}' ; '${MAMBA_EXE}' shell -s csh activate '${2}' ${argv[3-]})`"
set ask_conda="`(setenv prompt '${prompt}' ; '${MAMBA_EXE}' shell activate --shell csh '${2}' ${argv[3-]})`"
set conda_tmp_status=$status
if( $conda_tmp_status != 0 ) exit ${conda_tmp_status}
eval "${ask_conda}"
rehash
breaksw
case "deactivate":
set ask_conda="`(setenv prompt '${prompt}' ; '${MAMBA_EXE}' shell -s csh deactivate '${2}' ${argv[3-]})`"
set ask_conda="`(setenv prompt '${prompt}' ; '${MAMBA_EXE}' shell deactivate --shell csh '${2}' ${argv[3-]})`"
set conda_tmp_status=$status
if( $conda_tmp_status != 0 ) exit ${conda_tmp_status}
eval "${ask_conda}"
rehash
breaksw
case "install" | "update" | "upgrade" | "remove" | "uninstall":
$MAMBA_EXE $argv[1-]
set ask_conda="`(setenv prompt '${prompt}' ; '${MAMBA_EXE}' shell -s csh reactivate)`"
set ask_conda="`(setenv prompt '${prompt}' ; '${MAMBA_EXE}' shell reactivate --shell csh)`"
set conda_tmp_status=$status
if( $conda_tmp_status != 0 ) exit ${conda_tmp_status}
eval "${ask_conda}"
Expand Down
4 changes: 2 additions & 2 deletions libmamba/data/micromamba.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ __mamba_hashr() {

__mamba_activate() {
\local ask_conda
ask_conda="$(PS1="${PS1:-}" __mamba_exe shell --shell bash "$@")" || \return
ask_conda="$(PS1="${PS1:-}" __mamba_exe shell "$@" --shell bash)" || \return
\eval "$ask_conda"
__mamba_hashr
}

__mamba_reactivate() {
\local ask_conda
ask_conda="$(PS1="${PS1:-}" __mamba_exe shell --shell bash reactivate)" || \return
ask_conda="$(PS1="${PS1:-}" __mamba_exe shell reactivate --shell bash)" || \return
\eval "$ask_conda"
__mamba_hashr
}
Expand Down
2 changes: 2 additions & 0 deletions micromamba/src/shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ set_shell_command(CLI::App* shell_subcmd)
// ``micromamba shell init --shell bash`` and ``micromamba shell --shell bash init`` were
// allowed.
// We want to move everything to the first one, but keeping this for compatibility so far.
// TODO micromamba 2.0 deprecate `micromamba shell --shell bash cmd` and remove the following
// line
init_shell_parser(shell_subcmd);

set_shell_init_command(
Expand Down

0 comments on commit 4a4d544

Please sign in to comment.