tui

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildNameColumn

func BuildNameColumn(check ghclient.CheckRunInfo, widths ColumnWidths, enableLinks bool) string

BuildNameColumn returns a left-aligned name column of exactly widths.NameWidth visible characters. If enableLinks is true and the check has a DetailsURL, the visible text is wrapped in an OSC 8 hyperlink; padding spaces are appended outside the link so that len()-based width measurement stays accurate for the rest of the line.

func FormatAlignedColumns

func FormatAlignedColumns(queueText, nameText, durationText string, widths ColumnWidths) (string, string, string)

FormatAlignedColumns formats the three columns with proper padding

func FormatCheckName

func FormatCheckName(check ghclient.CheckRunInfo) string

FormatCheckName formats the check name as "Workflow / Job" or just "Job"

func FormatCheckNameWithTruncate

func FormatCheckNameWithTruncate(check ghclient.CheckRunInfo, maxWidth int) string

FormatCheckNameWithTruncate formats the check name and truncates if needed

func FormatDescription

func FormatDescription(description string, widths ColumnWidths) string

FormatDescription truncates description to fit within the total visual width

func FormatDuration

func FormatDuration(check ghclient.CheckRunInfo) string

FormatDuration returns the duration/runtime text or placeholder

func FormatHeaderColumns

func FormatHeaderColumns(widths ColumnWidths) (string, string, string)

FormatHeaderColumns formats the column headers with proper padding

func FormatLink(url, text string) string

FormatLink wraps text in an OSC 8 terminal hyperlink

func FormatQueueLatency

func FormatQueueLatency(check ghclient.CheckRunInfo, headCommitTime time.Time) string

FormatQueueLatency returns the queue time text or placeholder

func GetCheckIcon

func GetCheckIcon(status, conclusion string) string

GetCheckIcon returns the appropriate icon for a check run based on status and conclusion

Types

type ChecksUpdateMsg

type ChecksUpdateMsg struct {
	CheckRuns          []ghclient.CheckRunInfo
	RateLimitRemaining int
	Err                error
}

ChecksUpdateMsg contains updated check runs

type ColumnWidths

type ColumnWidths struct {
	QueueWidth    int // Right-aligned queue latency
	NameWidth     int // Left-aligned check name
	DurationWidth int // Right-aligned duration
}

ColumnWidths holds pre-calculated column widths for aligned rendering

func CalculateColumnWidths

func CalculateColumnWidths(checkRuns []ghclient.CheckRunInfo, headCommitTime time.Time) ColumnWidths

CalculateColumnWidths scans all check runs and determines max width for each column

type ErrorMsg

type ErrorMsg struct {
	Err error
}

ErrorMsg contains error information

type Model

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

Model holds the application state

func NewModel

func NewModel(ctx context.Context, token, owner, repo string, prNumber int, refreshInterval time.Duration, styles Styles, enableLinks bool) Model

NewModel creates a new TUI model

func (Model) ExitCode

func (m Model) ExitCode() int

ExitCode returns the exit code for the program

func (Model) Init

func (m Model) Init() tea.Cmd

Init initializes the model

func (Model) Update

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

Update handles messages

func (Model) View

func (m Model) View() tea.View

View renders the current state

type PRInfoMsg

type PRInfoMsg struct {
	Number         int
	Title          string
	HeadSHA        string
	CreatedAt      time.Time
	HeadCommitTime time.Time
	Err            error
}

PRInfoMsg contains PR metadata

type Styles

type Styles struct {
	Success     lipgloss.Style
	Failure     lipgloss.Style
	Running     lipgloss.Style
	Queued      lipgloss.Style
	Error       lipgloss.Style
	Header      lipgloss.Style
	Info        lipgloss.Style
	ErrorBox    lipgloss.Style
	Description lipgloss.Style
}

Styles holds all lipgloss styles for rendering

func NewStyles

func NewStyles(successColor, failureColor, runningColor, queuedColor int) Styles

NewStyles creates styled renderers based on config colors

type TickMsg

type TickMsg time.Time

TickMsg is sent on each poll interval

Jump to

Keyboard shortcuts

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