2024-07-27 19:06:26 -04:00
|
|
|
package ui
|
|
|
|
|
2025-09-15 21:04:31 +02:00
|
|
|
import "io"
|
|
|
|
|
2024-07-27 19:06:26 -04:00
|
|
|
// Terminal is used to write messages and display status lines which can be
|
|
|
|
// updated. See termstatus.Terminal for a concrete implementation.
|
|
|
|
type Terminal interface {
|
2025-09-21 16:32:00 +02:00
|
|
|
// Print writes a line to the terminal. Appends a newline if not present.
|
2024-07-27 19:06:26 -04:00
|
|
|
Print(line string)
|
2025-09-21 16:32:00 +02:00
|
|
|
// Error writes an error to the terminal. Appends a newline if not present.
|
2024-07-27 19:06:26 -04:00
|
|
|
Error(line string)
|
2025-09-21 16:32:00 +02:00
|
|
|
// SetStatus sets the status lines to the terminal.
|
2024-07-27 19:06:26 -04:00
|
|
|
SetStatus(lines []string)
|
2025-09-21 16:32:00 +02:00
|
|
|
// CanUpdateStatus returns true if the terminal can update the status lines.
|
2024-07-27 19:06:26 -04:00
|
|
|
CanUpdateStatus() bool
|
2025-09-21 16:32:00 +02:00
|
|
|
// 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.
|
2025-09-15 21:04:31 +02:00
|
|
|
OutputRaw() io.Writer
|
2025-09-14 17:58:52 +02:00
|
|
|
OutputIsTerminal() bool
|
2024-07-27 19:06:26 -04:00
|
|
|
}
|