Documentation
¶
Overview ¶
Package util provides utility types and functions for the OpenCode TUI.
This package includes:
- InfoMsg: Messages for displaying status information (info, warning, error)
- ClearStatusMsg: Message for clearing status display
- Helper functions for reporting errors, warnings, and info messages
These utilities are used across the TUI to display transient status messages to the user, such as error notifications or operation progress updates.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CmdHandler ¶
CmdHandler wraps a message into a tea.Cmd for asynchronous handling. This is a convenience function for creating commands that return a specific message.
func ReportError ¶
ReportError creates a command that reports an error message to the user. The error will be displayed as an InfoMsg with InfoTypeError.
func ReportInfo ¶
ReportInfo creates a command that reports an informational message to the user. The message will be displayed as an InfoMsg with InfoTypeInfo.
func ReportWarn ¶
ReportWarn creates a command that reports a warning message to the user. The message will be displayed as an InfoMsg with InfoTypeWarn.
Types ¶
type ClearStatusMsg ¶
type ClearStatusMsg struct{}
ClearStatusMsg is sent to clear any displayed status message.
type InfoMsg ¶
type InfoMsg struct {
// Type is the kind of message (Info, Warn, or Error).
Type InfoType
// Msg is the text content of the message.
Msg string
// TTL is the time duration after which the message should be cleared.
// A value of 0 means the message persists until manually cleared.
TTL time.Duration
}
InfoMsg is a message type for displaying status information to the user. It includes the message type (info, warning, error), the message text, and an optional time-to-live (TTL) for auto-dismissal.