Skip to content

Commit

Permalink
Adapt mamba name in Win powershell wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoinePrv committed Mar 12, 2024
1 parent e5426e1 commit 8ee9a5d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions libmamba/data/Mamba.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (-not $MambaModuleArgs.ContainsKey('ChangePs1')) {
function Enter-MambaEnvironment {
begin {
$activateCommand = (& $Env:MAMBA_EXE shell activate -s powershell $Args | Out-String);
Write-Verbose "[micromamba shell activate --shell powershell $Args]`n$activateCommand";
Write-Verbose "[mamba shell activate --shell powershell $Args]`n$activateCommand";
Invoke-Expression -Command $activateCommand;
}

Expand Down Expand Up @@ -58,7 +58,7 @@ function Exit-MambaEnvironment {
if ($deactivateCommand.Trim().Length -eq 0) {
return;
}
Write-Verbose "[micromamba shell deactivate --shell powershell]`n$deactivateCommand";
Write-Verbose "[mamba shell deactivate --shell powershell]`n$deactivateCommand";
Invoke-Expression -Command $deactivateCommand;
}
process {}
Expand Down Expand Up @@ -117,7 +117,7 @@ function Invoke-Mamba() {
{
$activateCommand = (& $Env:MAMBA_EXE shell reactivate -s powershell | Out-String);
if ($activateCommand) {
Write-Verbose "[micromamba shell reactivate --shell powershell]`n$activateCommand";
Write-Verbose "[mamba shell reactivate --shell powershell]`n$activateCommand";
Invoke-Expression -Command $activateCommand;
}
}
Expand All @@ -128,7 +128,7 @@ function Invoke-Mamba() {

## TAB COMPLETION ##############################################################

$MicromambaAutocompleteScriptblock = {
$MambaAutocompleteScriptblock = {
param($wordToComplete, $commandAst, $cursorPosition)
$RemainingArgs = $commandAst.ToString().Split()
$OneRemainingArgs = $RemainingArgs[1..$RemainingArgs.Length]
Expand Down Expand Up @@ -171,8 +171,9 @@ if ($MambaModuleArgs.ChangePs1) {

## ALIASES #####################################################################

New-Alias micromamba Invoke-Mamba -Force
Register-ArgumentCompleter -Native -CommandName micromamba -ScriptBlock $MicromambaAutocompleteScriptblock
$__mamba_name = [System.IO.Path]::GetFileNameWithoutExtension((Split-Path -Leaf $Env:MAMBA_EXE));
New-Alias -Name $__mamba_name -Value Invoke-Mamba -Force
Register-ArgumentCompleter -Native -CommandName $__mamba_name -ScriptBlock $MambaAutocompleteScriptblock

## EXPORTS ###################################################################

Expand Down

0 comments on commit 8ee9a5d

Please sign in to comment.