tui

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendBuildStatus

func SendBuildStatus(status BuildStatus) tea.Cmd

func SendRestartCount

func SendRestartCount() tea.Cmd

Types

type BuildStatus

type BuildStatus int

BuildStatus represents the status of the last build

const (
	StatusWatching BuildStatus = iota
	StatusBuilding
	StatusSuccess
	StatusError
)

type BuildStatusMsg

type BuildStatusMsg struct {
	Status BuildStatus
}

type ForceRestartMsg

type ForceRestartMsg struct{}

Custom message types

type LogEntry

type LogEntry struct {
	Message   string
	Type      LogType
	Timestamp time.Time
}

LogEntry represents a single log entry with timestamp and styling

type LogMessage

type LogMessage struct {
	Message string
	Type    LogType
}

LogMessage is sent through the channel to add new log entries

type LogType

type LogType int

LogType determines styling for log entries

const (
	LogTypeInfo LogType = iota
	LogTypeSuccess
	LogTypeError
	LogTypeRestart
	LogTypeEvent
)

type Model

type Model struct {
	// contains filtered or unexported fields
}

Model represents the state of our TUI application

func NewModel

func NewModel(watchDir string, debounceDuration time.Duration) Model

NewModel creates a new model with default values

func (*Model) AddLog

func (m *Model) AddLog(message string, logType LogType)

AddLog adds a new log entry to the model

func (*Model) ClearLogs

func (m *Model) ClearLogs()

ClearLogs removes all log entries

func (*Model) GetLogChan

func (m *Model) GetLogChan() chan LogMessage

GetLogChan returns the channel for sending log messages

func (*Model) IncrementRestartCount

func (m *Model) IncrementRestartCount()

IncrementRestartCount increases the restart counter

func (Model) Init

func (m Model) Init() tea.Cmd

Init initializes the model

func (*Model) SetBuildStatus

func (m *Model) SetBuildStatus(status BuildStatus)

SetBuildStatus updates the build status

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles all the IO and updates the model accordingly

func (Model) View

func (m Model) View() string

View renders the entire TUI

type RestartCountMsg

type RestartCountMsg struct{}

type Styles

type Styles struct {
	StatusBar       lipgloss.Style
	StatusBarKey    lipgloss.Style
	StatusBarValue  lipgloss.Style
	StatusWatching  lipgloss.Style
	StatusBuilding  lipgloss.Style
	StatusSuccess   lipgloss.Style
	StatusError     lipgloss.Style
	LogPanel        lipgloss.Style
	LogTimestamp    lipgloss.Style
	LogEntryInfo    lipgloss.Style
	LogEntrySuccess lipgloss.Style
	LogEntryError   lipgloss.Style
	LogEntryRestart lipgloss.Style
	LogEntryEvent   lipgloss.Style
	HelpBar         lipgloss.Style
	HelpKey         lipgloss.Style
	HelpDesc        lipgloss.Style
}

Styles holds all the styling for the TUI

type TUI

type TUI struct {
	// contains filtered or unexported fields
}

TUI holds the Bubble Tea program and integrates with the runner

func NewTUI

func NewTUI(watchDir string, debounceDuration time.Duration, runner *internal.Runner) *TUI

NewTUI creates a new TUI instance

func (*TUI) ForceRestart

func (t *TUI) ForceRestart()

ForceRestart triggers a manual restart

func (*TUI) GetProgram

func (t *TUI) GetProgram() *tea.Program

GetProgram returns the Bubble Tea program for external control

func (TUI) Init

func (t TUI) Init() tea.Cmd

Init implements tea.Model

func (*TUI) Start

func (t *TUI) Start() error

Start runs the TUI

func (*TUI) Stop

func (t *TUI) Stop()

Stop stops the TUI and the runner

func (TUI) Update

func (t TUI) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model

func (TUI) View

func (t TUI) View() string

View implements tea.Model

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL