Commit 053e4247 authored by Dustin L. Howett's avatar Dustin L. Howett

subshell: add nest/enter-nestedshell for a full nested ps instance + prompt

parent 46ac52ba
......@@ -37,8 +37,13 @@ Function pe_ShortHomePath {
}
Function pe_NestedPromptLevel {
If ($NestedPromptLevel -Gt 0) {
$PSLevel = [int]$Env:_DH_PS_NESTING_LEVEL
If ($NestedPromptLevel -Gt 0 -Or $PSLevel -Gt 0) {
Write-Host "<" -NoNewLine -ForegroundColor DarkYellow
If ($PSLevel -Gt 0) {
Write-Host "$PSLevel." -NoNewLine -ForegroundColor White
#Write-Host "$([char]0x1b)[38;5;208m$PSLevel.$([char]0x1b)[0m" -NoNewLine
}
Write-Host "$NestedPromptLevel" -NoNewLine -ForegroundColor Yellow
Write-Host "> " -NoNewLine -ForegroundColor DarkYellow
}
......
......@@ -8,3 +8,17 @@ Function Enter-Subshell {
}
New-Alias -Name ss -Value Enter-Subshell
Function Enter-NestedShell {
([int]$Env:_DH_PS_NESTING_LEVEL)++
Push-Location -StackName:"SubshellStack" -Path:$Path > $Null
If ($PSEdition -Eq "Desktop") {
& powershell.exe -NoLogo -NoExit
} Else {
& pwsh.exe -NoLogo -NoExit
}
Pop-Location -StackName:"SubshellStack" > $Null
([int]$Env:_DH_PS_NESTING_LEVEL)--
}
New-Alias -Name nest -Value Enter-NestedShell
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment