fix outdated message output order

This commit is contained in:
Katy Moe 2020-08-11 23:18:26 +01:00
parent 31f858e1bb
commit 25337b7217
No known key found for this signature in database
GPG Key ID: 8C3780F6DCDDA885
1 changed files with 8 additions and 7 deletions

View File

@ -53,6 +53,7 @@ Options:
func (c *VersionCommand) Run(args []string) int {
var outdated bool
var latest string
var versionString bytes.Buffer
args = c.Meta.process(args)
var jsonOutput bool
@ -113,13 +114,7 @@ func (c *VersionCommand) Run(args []string) int {
}
if info.Outdated {
outdated = true
if !jsonOutput {
c.Ui.Output(fmt.Sprintf(
"\nYour version of Terraform is out of date! The latest version\n"+
"is %s. You can update by downloading from https://www.terraform.io/downloads.html",
info.Latest))
}
latest = info.Latest
}
}
@ -159,6 +154,12 @@ func (c *VersionCommand) Run(args []string) int {
c.Ui.Output(str)
}
}
if outdated {
c.Ui.Output(fmt.Sprintf(
"\nYour version of Terraform is out of date! The latest version\n"+
"is %s. You can update by downloading from https://www.terraform.io/downloads.html",
latest))
}
}