Describe the bug
When uninstalling a package version that is not installed, tenv reports the operation as successful even though the version is not installed and/or does not exist.
e.g.
❯ tenv tf uninstall 0.0.0
Uninstallation of Terraform 0.0.0 successful (directory /home/USERNAME/.tenv/Terraform/0.0.0 removed)
❯ tenv tofu uninstall 0.0.0
Uninstallation of OpenTofu 0.0.0 successful (directory /home/USERNAME/.tenv/OpenTofu/0.0.0 removed)
❯ tenv tg uninstall 0.0.0
Uninstallation of Terragrunt 0.0.0 successful (directory /home/USERNAME/.tenv/Terragrunt/0.0.0 removed)
To Reproduce
Steps to reproduce the behavior:
- List the available or installed versions:
tenv tf list-remote
tenv tofu list-remote
tenv tg list-remote
-
Verify that version 0.0.0 is not installed.
-
Attempt to uninstall the non-existent version:
tenv tf uninstall 0.0.0
tenv tofu uninstall 0.0.0
tenv tg uninstall 0.0.0
- Observe that the command reports a successful uninstallation, for example:
Uninstallation of Terraform 0.0.0 successful (directory /home/USERNAME/.tenv/Terraform/0.0.0 removed)
Expected behavior
If the requested version is not installed, the command should return an error or warning instead of reporting success.
For example:
Terraform 0.0.0 is not installed.
or
Uninstallation of Terraform 0.0.0 failed: version is not installed.
Screenshots
N/A
Environment (please complete the following information):
OS: Arch Linux - 7.0.10-arch1-1
tenv version: v4.14.8
Additional context
The current behavior appears to treat the removal of a non-existent directory as a successful uninstall. It may be worth checking whether the target version exists before reporting success.
Describe the bug
When uninstalling a package version that is not installed, tenv reports the operation as successful even though the version is not installed and/or does not exist.
e.g.
❯
tenv tf uninstall 0.0.0Uninstallation of Terraform 0.0.0 successful (directory /home/USERNAME/.tenv/Terraform/0.0.0 removed)
❯
tenv tofu uninstall 0.0.0Uninstallation of OpenTofu 0.0.0 successful (directory /home/USERNAME/.tenv/OpenTofu/0.0.0 removed)
❯
tenv tg uninstall 0.0.0Uninstallation of Terragrunt 0.0.0 successful (directory /home/USERNAME/.tenv/Terragrunt/0.0.0 removed)
To Reproduce
Steps to reproduce the behavior:
tenv tf list-remotetenv tofu list-remotetenv tg list-remoteVerify that version 0.0.0 is not installed.
Attempt to uninstall the non-existent version:
tenv tf uninstall 0.0.0tenv tofu uninstall 0.0.0tenv tg uninstall 0.0.0Uninstallation of Terraform 0.0.0 successful (directory /home/USERNAME/.tenv/Terraform/0.0.0 removed)Expected behavior
If the requested version is not installed, the command should return an error or warning instead of reporting success.
For example:
Terraform 0.0.0 is not installed.or
Uninstallation of Terraform 0.0.0 failed: version is not installed.Screenshots
N/A
Environment (please complete the following information):
OS: Arch Linux - 7.0.10-arch1-1
tenv version: v4.14.8
Additional context
The current behavior appears to treat the removal of a non-existent directory as a successful uninstall. It may be worth checking whether the target version exists before reporting success.