add colored prefix to progress tracker bar so it's clearer what build an uploading file belongs to (#9780)

This commit is contained in:
Megan Marsh 2020-08-17 11:32:13 -07:00 committed by GitHub
parent d74b47b734
commit c88ff4ec45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -91,6 +91,10 @@ func (u *ColoredUi) Machine(t string, args ...string) {
u.Ui.Machine(t, args...) 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 { func (u *ColoredUi) colorize(message string, color UiColor, bold bool) string {
if !u.supportsColors() { if !u.supportsColors() {
return message 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 { 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 // The BasicUI is a UI that reads and writes from a standard Go reader