packer: ColoredUi bolds, but doesn't bold messages

This commit is contained in:
Mitchell Hashimoto 2013-06-03 13:49:59 -07:00
parent 3a61196f15
commit 3e1b10c09e
1 changed files with 10 additions and 5 deletions

View File

@ -48,19 +48,24 @@ type ReaderWriterUi struct {
}
func (u *ColoredUi) Say(message string) {
u.Ui.Say(u.colorize(message))
u.Ui.Say(u.colorize(message, true))
}
func (u *ColoredUi) Message(message string) {
u.Ui.Message(u.colorize(message))
u.Ui.Message(u.colorize(message, false))
}
func (u *ColoredUi) Error(message string) {
u.Ui.Error(u.colorize(message))
u.Ui.Error(u.colorize(message, false))
}
func (u *ColoredUi) colorize(message string) string {
return fmt.Sprintf("\033[0;%d;40m%s\033[0m", u.Color, message)
func (u *ColoredUi) colorize(message string, bold bool) string {
attr := 0
if bold {
attr = 1
}
return fmt.Sprintf("\033[%d;%d;40m%s\033[0m", attr, u.Color, message)
}
func (u *PrefixedUi) Say(message string) {