pwsh: Fix error in shell integration if pyenv is on PATH multiple times

Fixes "The term 'pyenv pyenv' is not recognized..."
This commit is contained in:
Ivan Pozdeev 2026-09-09 02:17:04 +03:00
parent 798a1ad603
commit 88e9ab13e8

View file

@ -473,12 +473,12 @@ function pyenv {
}
if ( ("${commands[*]}" -split ' ') -contains \$command ) {
\$shell_cmds = (& (get-command -commandtype application pyenv) sh-\$command \$args)
\$shell_cmds = (& (get-command -commandtype application pyenv -totalcount 1) sh-\$command \$args)
if ( \$shell_cmds.Count -gt 0 ) {
iex (\$shell_cmds -join "\`n")
}
} else {
& (get-command -commandtype application pyenv) \$command \$args
& (get-command -commandtype application pyenv -totalcount 1) \$command \$args
}
}
EOS