Allow activating venv in current folder.

This commit is contained in:
Mikael CAPELLE 2023-04-06 10:28:09 +02:00
parent bb2f454add
commit b3b446599a
2 changed files with 4 additions and 1 deletions

View File

@ -23,7 +23,7 @@ Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
Set-PSReadlineOption -BellStyle None Set-PSReadlineOption -BellStyle None
# kube # kube / helm
if (Get-Command kubectl -ErrorAction SilentlyContinue) { if (Get-Command kubectl -ErrorAction SilentlyContinue) {
kubectl completion powershell | Out-String | Invoke-Expression kubectl completion powershell | Out-String | Invoke-Expression
} }

View File

@ -36,6 +36,9 @@ function venv {
if (Test-Path "$env:WORKON_HOME/$venv/Scripts/activate.ps1") { if (Test-Path "$env:WORKON_HOME/$venv/Scripts/activate.ps1") {
& "$env:WORKON_HOME/$venv/Scripts/activate.ps1" & "$env:WORKON_HOME/$venv/Scripts/activate.ps1"
} }
elseif (Test-Path (Join-Path $PWD $venv)) {
& "$venv/Scripts/activate.ps1"
}
elseif ((!$venv -Or !$venv.Trim()) -And (Test-Path "venv/Scripts/activate.ps1")) { elseif ((!$venv -Or !$venv.Trim()) -And (Test-Path "venv/Scripts/activate.ps1")) {
& "venv/Scripts/activate.ps1" & "venv/Scripts/activate.ps1"
} }