From 06996da55d4f2459677d1016249c2bd5765c2c03 Mon Sep 17 00:00:00 2001 From: Chris ter Beke <1134120+ChrisTerBeke@users.noreply.github.com> Date: Tue, 27 Feb 2024 09:43:32 +0100 Subject: [PATCH] Fix logging when version was actually found and installed --- pkg/install/install.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/install/install.go b/pkg/install/install.go index 7c483e2..01ae939 100644 --- a/pkg/install/install.go +++ b/pkg/install/install.go @@ -54,6 +54,10 @@ 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 != "" { @@ -61,5 +65,4 @@ func InstallRequiredVersion() { break } } - fmt.Println("No required version found in .tf files in the current directory") }