Documentation
¶
Overview ¶
Package ui provides an interactive terminal user interface for link checking. It uses the Bubble Tea framework to create a real-time TUI that displays scanning progress, check results, and allows filtering by link status.
Index ¶
- Variables
- func ExtractLinksCmdWithRegistry(files []string, strictMode bool) tea.Cmd
- func ScanFilesCmdWithOptions(path string, fileTypes, include, exclude []string) tea.Cmd
- func SpinnerStyle() lipgloss.Style
- func StartCheckingCmd(links []checker.Link, state *CheckerState) tea.Cmd
- func StatusBadge(status checker.LinkStatus) string
- func StatusTextStyle(status checker.LinkStatus) lipgloss.Style
- func SummaryAlive(count int) string
- func SummaryDead(count int) string
- func SummaryDuplicates(count int) string
- func SummaryWarnings(count int) string
- func WaitForNextResultCmd(state *CheckerState) tea.Cmd
- type AllChecksCompleteMsg
- type CheckerState
- type FilesFoundMsg
- type KeyMap
- type LinkCheckedMsg
- type LinksExtractedMsg
- type Model
- type ResultItem
- type WindowSizeMsg
Constants ¶
This section is empty.
Variables ¶
var ( PrimaryColor = lipgloss.Color("205") // Pink SecondaryColor = lipgloss.Color("241") // Gray SuccessColor = lipgloss.Color("82") // Green ErrorColor = lipgloss.Color("196") // Red WarningColor = lipgloss.Color("214") // Orange BlockedColor = lipgloss.Color("208") // Dark orange DuplicateColor = lipgloss.Color("139") // Purple/gray MutedColor = lipgloss.Color("245") // Dimmed text )
Color palette.
var ( TitleStyle = lipgloss.NewStyle(). Bold(true). Foreground(PrimaryColor). MarginBottom(1) StatusStyle = lipgloss.NewStyle(). Foreground(SecondaryColor) SuccessStyle = lipgloss.NewStyle(). Foreground(SuccessColor) ErrorStyle = lipgloss.NewStyle(). Foreground(ErrorColor) WarningStyle = lipgloss.NewStyle(). Foreground(WarningColor) BlockedStyle = lipgloss.NewStyle(). Foreground(BlockedColor) DuplicateStyle = lipgloss.NewStyle(). Foreground(DuplicateColor) SelectedStyle = lipgloss.NewStyle(). Foreground(PrimaryColor). Bold(true) NormalStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("252")) HelpStyle = lipgloss.NewStyle(). Foreground(SecondaryColor). MarginTop(1) MutedStyle = lipgloss.NewStyle(). Foreground(MutedColor) // Detail panel styles. DetailBoxStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(SecondaryColor). Padding(0, 1). MarginTop(1) DetailLabelStyle = lipgloss.NewStyle(). Foreground(SecondaryColor). Bold(true) DetailValueStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("252")) DetailNoteStyle = lipgloss.NewStyle(). Foreground(MutedColor). Italic(true) )
Text styles.
var ( BadgeAlive = lipgloss.NewStyle(). Foreground(lipgloss.Color("255")). Background(SuccessColor). Padding(0, 1). Bold(true) BadgeRedirect = lipgloss.NewStyle(). Foreground(lipgloss.Color("0")). Background(WarningColor). Padding(0, 1). Bold(true) BadgeBlocked = lipgloss.NewStyle(). Foreground(lipgloss.Color("255")). Background(BlockedColor). Padding(0, 1). Bold(true) BadgeDead = lipgloss.NewStyle(). Foreground(lipgloss.Color("255")). Background(ErrorColor). Padding(0, 1). Bold(true) BadgeError = lipgloss.NewStyle(). Foreground(lipgloss.Color("255")). Background(lipgloss.Color("161")). Padding(0, 1). Bold(true) BadgeDuplicate = lipgloss.NewStyle(). Foreground(lipgloss.Color("255")). Background(DuplicateColor). Padding(0, 1). Bold(true) )
Badge styles for status codes.
Functions ¶
func ExtractLinksCmdWithRegistry ¶ added in v0.1.3
ExtractLinksCmdWithRegistry extracts links from the given files using the parser registry.
func ScanFilesCmdWithOptions ¶ added in v0.1.3
ScanFilesCmdWithOptions returns a command that scans for files using ScanOptions. This supports include/exclude glob patterns from the config file.
func SpinnerStyle ¶
SpinnerStyle returns the style for the spinner.
func StartCheckingCmd ¶
func StartCheckingCmd(links []checker.Link, state *CheckerState) tea.Cmd
StartCheckingCmd initializes the checker and returns the first result.
func StatusBadge ¶
func StatusBadge(status checker.LinkStatus) string
StatusBadge returns a styled badge for the given link status.
func StatusTextStyle ¶
func StatusTextStyle(status checker.LinkStatus) lipgloss.Style
StatusTextStyle returns the appropriate style for a link status.
func SummaryAlive ¶
SummaryAlive returns a styled count for alive links.
func SummaryDead ¶
SummaryDead returns a styled count for dead links.
func SummaryDuplicates ¶
SummaryDuplicates returns a styled count for duplicate links.
func SummaryWarnings ¶
SummaryWarnings returns a styled count for warning links.
func WaitForNextResultCmd ¶
func WaitForNextResultCmd(state *CheckerState) tea.Cmd
WaitForNextResultCmd waits for the next result from the channel.
Types ¶
type AllChecksCompleteMsg ¶
type AllChecksCompleteMsg struct{}
AllChecksCompleteMsg is sent when all link checks have finished.
type CheckerState ¶
type CheckerState struct {
ResultsChan <-chan checker.Result
CancelFunc context.CancelFunc
}
CheckerState holds the state needed for checking links. This allows the commands to be stateless functions.
type FilesFoundMsg ¶
FilesFoundMsg is sent when markdown files have been discovered.
type KeyMap ¶
type KeyMap struct {
Up key.Binding
Down key.Binding
Filter key.Binding
Help key.Binding
Quit key.Binding
PageUp key.Binding
PageDown key.Binding
Home key.Binding
End key.Binding
}
KeyMap defines all key bindings for the application.
type LinkCheckedMsg ¶
LinkCheckedMsg is sent when a single link has been checked.
type LinksExtractedMsg ¶
type LinksExtractedMsg struct {
Err error
Links []checker.Link
UniqueURLs int // Number of unique URLs to check
Duplicates int // Number of duplicate occurrences
}
LinksExtractedMsg is sent when links have been extracted from files.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the main application model.
func New ¶
func New( path string, urlFilter *filter.Filter, fileTypes []string, strictMode bool, scanInclude, scanExclude []string, ) Model
New creates and returns a new Model for the given path. Optional filter can be passed to ignore certain URLs. fileTypes specifies which file types to scan (e.g., ["md", "json"]). strictMode causes parsing to fail on malformed files. scanInclude/scanExclude are optional glob patterns to filter files.
type ResultItem ¶
ResultItem wraps a checker.Result to implement list.Item interface.
func ResultsToItems ¶
func ResultsToItems(results []checker.Result) []ResultItem
ResultsToItems converts a slice of checker.Result to ResultItems.
func (ResultItem) Description ¶
func (i ResultItem) Description() string
Description returns secondary text for the item. Implements list.DefaultItem interface.
func (ResultItem) DetailView ¶
func (i ResultItem) DetailView() string
DetailView returns an expanded detail view for the selected item.
func (ResultItem) FilterValue ¶
func (i ResultItem) FilterValue() string
FilterValue returns the string used for filtering. Implements list.Item interface.
func (ResultItem) Title ¶
func (i ResultItem) Title() string
Title returns the main display text for the item. Implements list.DefaultItem interface.
type WindowSizeMsg ¶
WindowSizeMsg is sent when the terminal window size changes.