init: show successful installs in cyan (#10557)

This commit is contained in:
Adrien Delorme 2021-02-04 11:11:42 +01:00 committed by GitHub
parent 8ccd164f25
commit 92ccd5fa1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -9,6 +9,7 @@ import (
"strings" "strings"
pluginsdk "github.com/hashicorp/packer-plugin-sdk/plugin" pluginsdk "github.com/hashicorp/packer-plugin-sdk/plugin"
"github.com/hashicorp/packer/packer"
plugingetter "github.com/hashicorp/packer/packer/plugin-getter" plugingetter "github.com/hashicorp/packer/packer/plugin-getter"
"github.com/hashicorp/packer/packer/plugin-getter/github" "github.com/hashicorp/packer/packer/plugin-getter/github"
"github.com/hashicorp/packer/version" "github.com/hashicorp/packer/version"
@ -94,6 +95,11 @@ func (c *InitCommand) RunContext(buildCtx context.Context, cla *InitArgs) int {
}, },
} }
ui := &packer.ColoredUi{
Color: packer.UiColorCyan,
Ui: c.Ui,
}
for _, pluginRequirement := range reqs { for _, pluginRequirement := range reqs {
// Get installed plugins that match requirement // Get installed plugins that match requirement
@ -119,7 +125,7 @@ func (c *InitCommand) RunContext(buildCtx context.Context, cla *InitArgs) int {
} }
if newInstall != nil { if newInstall != nil {
msg := fmt.Sprintf("Installed plugin %s %s in %q", pluginRequirement.Identifier.ForDisplay(), newInstall.Version, newInstall.BinaryPath) msg := fmt.Sprintf("Installed plugin %s %s in %q", pluginRequirement.Identifier.ForDisplay(), newInstall.Version, newInstall.BinaryPath)
c.Ui.Say(msg) ui.Say(msg)
} }
} }
return ret return ret