feat(pwsh): pass original last execution status to Set-PoshContext for use in pwsh alias

This commit is contained in:
Aria Bounds 2024-07-27 07:13:49 -07:00 committed by Jan De Dobbeleer
parent b4e19adae1
commit a43f57dd79
2 changed files with 3 additions and 3 deletions

View file

@ -113,7 +113,7 @@ New-Module -Name "oh-my-posh-core" -ScriptBlock {
$stdoutTask.Result $stdoutTask.Result
} }
function Set-PoshContext {} function Set-PoshContext([bool]$originalStatus) {}
function Get-CleanPSWD { function Get-CleanPSWD {
$pswd = $PWD.ToString() $pswd = $PWD.ToString()
@ -388,7 +388,7 @@ Example:
catch {} catch {}
} }
Set-PoshContext Set-PoshContext $script:ErrorCode
} }
function Update-PoshErrorCode { function Update-PoshErrorCode {

View file

@ -58,7 +58,7 @@ This can be used to for example populate an environment variable with a specific
<TabItem value="powershell"> <TabItem value="powershell">
```powershell ```powershell
function Set-EnvVar { function Set-EnvVar([bool]$originalStatus) {
$env:POSH=$(Get-Date) $env:POSH=$(Get-Date)
} }
New-Alias -Name 'Set-PoshContext' -Value 'Set-EnvVar' -Scope Global -Force New-Alias -Name 'Set-PoshContext' -Value 'Set-EnvVar' -Scope Global -Force