From 60955d8c2c8a148687b48daf1066e0e431b518fd Mon Sep 17 00:00:00 2001 From: Matthew Hooker Date: Thu, 9 Feb 2017 17:41:42 -0800 Subject: [PATCH 1/2] don't show ui color if we're not colorized --- command/build.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/command/build.go b/command/build.go index 3d9a29ded..5aafa8620 100644 --- a/command/build.go +++ b/command/build.go @@ -92,10 +92,12 @@ func (c BuildCommand) Run(args []string) int { Color: colors[i%len(colors)], Ui: ui, } + if _, ok := c.Ui.(*packer.MachineReadableUi); !ok { + ui.Say(fmt.Sprintf("%s output will be in this color.", b)) + } } buildUis[b] = ui - ui.Say(fmt.Sprintf("%s output will be in this color.", b)) } // Add a newline between the color output and the actual output From 11354aa1b7adb49b80477e1214713cc8d80ac043 Mon Sep 17 00:00:00 2001 From: Matthew Hooker Date: Thu, 9 Feb 2017 17:45:42 -0800 Subject: [PATCH 2/2] tidy up new line --- command/build.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/command/build.go b/command/build.go index 5aafa8620..9cb382311 100644 --- a/command/build.go +++ b/command/build.go @@ -94,15 +94,16 @@ func (c BuildCommand) Run(args []string) int { } if _, ok := c.Ui.(*packer.MachineReadableUi); !ok { ui.Say(fmt.Sprintf("%s output will be in this color.", b)) + if i+1 == len(buildNames) { + // Add a newline between the color output and the actual output + c.Ui.Say("") + } } } buildUis[b] = ui } - // Add a newline between the color output and the actual output - c.Ui.Say("") - log.Printf("Build debug mode: %v", cfgDebug) log.Printf("Force build: %v", cfgForce) log.Printf("On error: %v", cfgOnError)