From c88ff4ec45013e984fb3510d9b842c5a7230d6fc Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Mon, 17 Aug 2020 11:32:13 -0700 Subject: [PATCH] add colored prefix to progress tracker bar so it's clearer what build an uploading file belongs to (#9780) --- packer/ui.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packer/ui.go b/packer/ui.go index 593c46e13..5d8cb89ed 100644 --- a/packer/ui.go +++ b/packer/ui.go @@ -91,6 +91,10 @@ func (u *ColoredUi) Machine(t string, args ...string) { u.Ui.Machine(t, args...) } +func (u *ColoredUi) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) io.ReadCloser { + return u.Ui.TrackProgress(u.colorize(src, u.Color, false), currentSize, totalSize, stream) +} + func (u *ColoredUi) colorize(message string, color UiColor, bold bool) string { if !u.supportsColors() { return message @@ -172,7 +176,7 @@ func (u *TargetedUI) prefixLines(arrow bool, message string) string { } func (u *TargetedUI) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) io.ReadCloser { - return u.Ui.TrackProgress(src, currentSize, totalSize, stream) + return u.Ui.TrackProgress(u.prefixLines(false, src), currentSize, totalSize, stream) } // The BasicUI is a UI that reads and writes from a standard Go reader