From 86412155815d93c77563e8620fdc677425c3991c Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 7 Jun 2013 22:15:12 -0700 Subject: [PATCH] command/build: Much improved artifact output --- command/build/command.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/command/build/command.go b/command/build/command.go index eced6ab6a..844df8219 100644 --- a/command/build/command.go +++ b/command/build/command.go @@ -1,6 +1,7 @@ package build import ( + "bytes" "flag" "fmt" "github.com/mitchellh/packer/packer" @@ -189,13 +190,16 @@ func (c Command) Run(env packer.Environment, args []string) int { // Output all the artifacts env.Ui().Say("\n==> The build completed! The artifacts created were:") for name, artifact := range artifacts { - env.Ui().Say(fmt.Sprintf("--> %s:", name)) + var message bytes.Buffer + fmt.Fprintf(&message, "--> %s: ", name) if artifact != nil { - env.Ui().Say(artifact.String()) + fmt.Fprintf(&message, artifact.String()) } else { - env.Ui().Say("") + fmt.Print("") } + + env.Ui().Say(message.String()) } return 0