command/version: drop empty line on version check (#14858)

We always add an empty line when asking/checking the version. We should only do
that if there is a new version available. While this is purely cosmetic, it
reads better and is consistent with packer.
This commit is contained in:
Antoine Jacoutot 2019-07-06 15:18:13 +02:00 committed by Kristin Laemmert
parent f4abb96b08
commit 37a6331ebf
1 changed files with 2 additions and 4 deletions

View File

@ -98,18 +98,16 @@ func (c *VersionCommand) Run(args []string) int {
// If we have a version check function, then let's check for
// the latest version as well.
if c.CheckFunc != nil {
// Separate the prior output with a newline
c.Ui.Output("")
// Check the latest version
info, err := c.CheckFunc()
if err != nil {
c.Ui.Error(fmt.Sprintf(
"Error checking latest version: %s", err))
"\nError checking latest version: %s", err))
}
if info.Outdated {
c.Ui.Output(fmt.Sprintf(
"Your version of Terraform is out of date! The latest version\n"+
"\nYour version of Terraform is out of date! The latest version\n"+
"is %s. You can update by downloading from www.terraform.io/downloads.html",
info.Latest))
}