Documentation
¶
Overview ¶
Package tui implements the interactive terminal dashboard for portctl.
Index ¶
- func HelpEntries() []struct{ ... }
- func RenderGroupHeader(g ProcessGroup, width int, selected bool) string
- func RenderTableHeader(width int) string
- func RenderTableRow(e *scanner.PortEntry, width int, selected bool) string
- func SortEntries(entries []scanner.PortEntry, col SortColumn)
- type Config
- type DetailModel
- type FilterModel
- type KeyMap
- type Model
- type ProcessGroup
- type SortColumn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HelpEntries ¶
func HelpEntries() []struct{ Key, Desc string }
HelpEntries returns ordered help text for the help overlay.
func RenderGroupHeader ¶
func RenderGroupHeader(g ProcessGroup, width int, selected bool) string
RenderGroupHeader renders one collapsed group row: "node (5 ports: 3000, 3001, 5173, 5174, 8080)"
func RenderTableHeader ¶
RenderTableHeader returns the styled header row.
func RenderTableRow ¶
RenderTableRow returns a styled row for a single entry.
func SortEntries ¶
func SortEntries(entries []scanner.PortEntry, col SortColumn)
SortEntries sorts entries by the given column.
Types ¶
type DetailModel ¶
DetailModel holds the detail panel state.
func (*DetailModel) View ¶
func (d *DetailModel) View(height int) string
View renders the detail panel for the selected entry.
type FilterModel ¶
FilterModel holds the state of the inline filter bar.
func (*FilterModel) Apply ¶
func (f *FilterModel) Apply(entries []scanner.PortEntry) []scanner.PortEntry
Apply returns only entries matching the filter text. Matches against port number (prefix) or process name (substring, case-insensitive).
func (*FilterModel) View ¶
func (f *FilterModel) View(totalCount, matchCount int) string
View renders the filter bar.
type KeyMap ¶
type KeyMap struct {
Up key.Binding
Down key.Binding
Filter key.Binding
Escape key.Binding
Enter key.Binding
Kill key.Binding
Sort key.Binding
Group key.Binding
Refresh key.Binding
Help key.Binding
Quit key.Binding
Yes key.Binding
No key.Binding
}
KeyMap holds all keybindings for the TUI.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the top-level bubbletea model for the TUI dashboard.
func NewModel ¶
func NewModel(s scanner.PortScanner, k *killer.DefaultKiller, cfg Config) Model
NewModel creates a new TUI model.
type ProcessGroup ¶
ProcessGroup is a set of entries collapsed under one process name.
func GroupByProcess ¶
func GroupByProcess(entries []scanner.PortEntry) []ProcessGroup
GroupByProcess collapses entries by process name, preserving order of first appearance.
type SortColumn ¶
type SortColumn int
SortColumn identifies which column the table is sorted by.
const ( SortPort SortColumn = iota SortPID SortProcess SortUser SortUptime )
Sort column constants.
func NextSortColumn ¶
func NextSortColumn(c SortColumn) SortColumn
NextSortColumn cycles to the next sort column.
func (SortColumn) String ¶
func (s SortColumn) String() string
String returns the display label for a sort column.