termstatus: Do formatting in Message, not Terminal

This commit is contained in:
greatroar
2024-05-21 12:15:22 +02:00
parent 66d03c797e
commit 46f04bc5f0
2 changed files with 9 additions and 17 deletions

View File

@@ -252,23 +252,11 @@ func (t *Terminal) Print(line string) {
t.print(line, false)
}
// Printf uses fmt.Sprintf to write a line to the terminal.
func (t *Terminal) Printf(msg string, args ...interface{}) {
s := fmt.Sprintf(msg, args...)
t.Print(s)
}
// Error writes an error to the terminal.
func (t *Terminal) Error(line string) {
t.print(line, true)
}
// Errorf uses fmt.Sprintf to write an error line to the terminal.
func (t *Terminal) Errorf(msg string, args ...interface{}) {
s := fmt.Sprintf(msg, args...)
t.Error(s)
}
// Truncate s to fit in width (number of terminal cells) w.
// If w is negative, returns the empty string.
func Truncate(s string, w int) string {