Skip to content

Commit

Permalink
fix: Update 'show' methods which output values to user to print strai…
Browse files Browse the repository at this point in the history
…ght to stdout rather than using logging methods

This avoids stylising output, as is done with logging.
Avoids sending output to same destination as logs, which is now stderr

Issue #505

Signed-off-by: Matthew John <[email protected]>
  • Loading branch information
MatthewJohn committed Sep 18, 2024
1 parent c2a228f commit ef79408
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/list_versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,15 @@ func validMinorVersionFormat(version string) bool {
// ShowLatestVersion show install latest stable tf version
func ShowLatestVersion(mirrorURL string) {
tfversion, _ := getTFLatest(mirrorURL)
logger.Infof("%s", tfversion)
fmt.Printf("%s\n", tfversion)
}

// ShowLatestImplicitVersion show latest - argument (version) must be provided
func ShowLatestImplicitVersion(requestedVersion, mirrorURL string, preRelease bool) {
if validMinorVersionFormat(requestedVersion) {
tfversion, _ := getTFLatestImplicit(mirrorURL, preRelease, requestedVersion)
if len(tfversion) > 0 {
logger.Infof("%s", tfversion)
fmt.Printf("%s\n", tfversion)
} else {
logger.Fatal("The provided terraform version does not exist.\n Try `tfswitch -l` to see all available versions")
os.Exit(1)
Expand Down

0 comments on commit ef79408

Please sign in to comment.