Update 'venv list'.

This commit is contained in:
Mikaël Capelle 2022-08-25 13:39:27 +02:00
parent 3e3efc9650
commit bb2f454add

View File

@ -23,11 +23,12 @@ function venv {
$venv)
switch ($command) {
"list" {
Get-ChildItem -Directory $env:WORKON_HOME
| ForEach-Object {
$name = $_.Name
$version = (& "$_/Scripts/python.exe" --version)
Write-Output "${name}: $version"
@(Get-ChildItem -Directory $env:WORKON_HOME | ForEach-Object {
$name = $_.Name
$version = (& "$_/Scripts/python.exe" --version).Replace("Python ", "")
@{Name = $name; Version = $version; Path = $_ }
}) | ForEach-Object {
New-Object object | Add-Member -NotePropertyMembers $_ -PassThru
}
}