Documentation
¶
Overview ¶
Package ui implements a command-line user interface using tea.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
LogWriter *TeaLogWriter
Initialized atomic.Bool
Ready atomic.Bool
Failed atomic.Bool
// contains filtered or unexported fields
}
Handler is the principal implementation of a user interface Handler.
func NewHandler ¶
func NewHandler(ctx context.Context, cancel context.CancelFunc, queueManager *queue.Manager) *Handler
NewHandler returns a pointer to a new user interface Handler.
func (*Handler) Launch ¶
Launch starts the command-line user interface (the tea.Program).
type LogMsg ¶
type LogMsg string
LogMsg is a regular string containing a log message. It is typed for identification as tea.Msg within a tea.Program.
type QueueProgressMsg ¶
type QueueProgressMsg struct {
// contains filtered or unexported fields
}
QueueProgressMsg is a tea.Msg containing queue.Progress information.
type TeaLogWriter ¶
type TeaLogWriter struct {
// contains filtered or unexported fields
}
TeaLogWriter is an implementation of an io.Writer, for use inside a [slog.Handler], that sends any logs to a tea.Program as tea.Msg.
func NewTeaLogWriter ¶
func NewTeaLogWriter(program teaProgramProvider) *TeaLogWriter
NewTeaLogWriter returns a pointer to a new TeaLogWriter. It also starts the internal log processing function, which should eventually be stopped e.g. with a deferred TeaLogWriter.Stop call.
func (*TeaLogWriter) Stop ¶
func (wr *TeaLogWriter) Stop()
Stop destroys the TeaLogWriter and stops any log message processing. This should be called when no more logs are actively being sent, as any in-flight or late logs will be discarded after calling this method.
type TeaModel ¶
type TeaModel struct {
// contains filtered or unexported fields
}
TeaModel is the principal tea.Model for the command-line user interface.
func NewTeaModel ¶
func NewTeaModel(uiHandler *Handler, cancel context.CancelFunc) TeaModel
NewTeaModel returns an initial new TeaModel.
func (TeaModel) Init ¶
Init initializes the model within a tea.Program.