Skip to content

Commit

Permalink
fix: install command was overwriting the env if it already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
arzkar committed Aug 16, 2022
1 parent cc5cb0a commit 3cbf475
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.1
0.4.2
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Invoke-WebRequest -UseBasicParsing -Uri "https://raw.githubusercontent.com/pyenv

```
> pyenv-win-venv
pyenv-win-venv v0.4.1
pyenv-win-venv v0.4.2
Copyright (c) Arbaaz Laskar <[email protected]>
Usage: pyenv-win-venv <command> <args>
Expand Down
11 changes: 8 additions & 3 deletions bin/pyenv-win-venv.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,14 @@ function main {
elseif ($subcommand1 -eq "install") {
if (test-path -PathType container "$pyenv_versions_dir\$subcommand2") {
if ($subcommand3 -ne "self") {
Write-Host "Installing env: $subcommand3 using Python v$subcommand2"
pyenv shell $subcommand2
python -m venv "$app_env_dir\$subcommand3"
if (!(test-path -PathType container "$app_env_dir\$subcommand3")) {
Write-Host "Installing env: $subcommand3 using Python v$subcommand2"
pyenv shell $subcommand2
python -m venv "$app_env_dir\$subcommand3"
}
else {
Write-Host "`"$subcommand3`" already exists. Please choose another name for the env."
}
}
else {
Write-Host "Cannot create an env called `"self`" since while uninstalling pyenv-venv uninstall self is already a pre-existing command!"
Expand Down

0 comments on commit 3cbf475

Please sign in to comment.