Documentation ¶
Index ¶
- func IsProcessBackground(fd uintptr) bool
- type Terminal
- func (t *Terminal) CanUpdateStatus() bool
- func (t *Terminal) Error(line string)
- func (t *Terminal) Errorf(msg string, args ...interface{})
- func (t *Terminal) Print(line string)
- func (t *Terminal) Printf(msg string, args ...interface{})
- func (t *Terminal) Run(ctx context.Context)
- func (t *Terminal) SetStatus(lines []string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsProcessBackground ¶
IsProcessBackground reports whether the current process is running in the background. fd must be a file descriptor for the terminal.
Types ¶
type Terminal ¶
type Terminal struct {
// contains filtered or unexported fields
}
Terminal is used to write messages and display status lines which can be updated. When the output is redirected to a file, the status lines are not printed.
func New ¶
New returns a new Terminal for wr. A goroutine is started to update the terminal. It is terminated when ctx is cancelled. When wr is redirected to a file (e.g. via shell output redirection) or is just an io.Writer (not the open *os.File for stdout), no status lines are printed. The status lines and normal output (via Print/Printf) are written to wr, error messages are written to errWriter. If disableStatus is set to true, no status messages are printed even if the terminal supports it.
func (*Terminal) CanUpdateStatus ¶
CanUpdateStatus return whether the status output is updated in place.