ui: document Message / Printer / Terminal interfaces

This commit is contained in:
Michael Eischer
2025-09-21 16:32:00 +02:00
parent 2fe271980f
commit 86ddee8518
3 changed files with 29 additions and 11 deletions

View File

@@ -5,9 +5,16 @@ import "io"
// Terminal is used to write messages and display status lines which can be
// updated. See termstatus.Terminal for a concrete implementation.
type Terminal interface {
// Print writes a line to the terminal. Appends a newline if not present.
Print(line string)
// Error writes an error to the terminal. Appends a newline if not present.
Error(line string)
// SetStatus sets the status lines to the terminal.
SetStatus(lines []string)
// CanUpdateStatus returns true if the terminal can update the status lines.
CanUpdateStatus() bool
// OutputRaw returns the output writer. Should only be used if there is no
// other option. Must not be used in combination with Print, Error, SetStatus
// or any other method that writes to the terminal.
OutputRaw() io.Writer
}