Skip to content

Commit

Permalink
Fix logging when version was actually found and installed
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisTerBeke committed Feb 27, 2024
1 parent 4a4e767 commit 06996da
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/install/install.go
Expand Up @@ -54,12 +54,15 @@ func InstallLatestVersion(preRelease bool) {
// InstallRequiredVersion installs the required Terraform version from the .tf files in the current directory
func InstallRequiredVersion() {
terraformFiles := helpers.FindTerraformFiles()
if len(terraformFiles) == 0 {
fmt.Println("No Terraform files found in current directory")
os.Exit(1)
}
for _, file := range terraformFiles {
requiredVersion := helpers.FindRequiredVersionInFile(file)
if requiredVersion != "" {
InstallVersion(requiredVersion)
break
}
}
fmt.Println("No required version found in .tf files in the current directory")
}

0 comments on commit 06996da

Please sign in to comment.