Documentation
¶
Overview ¶
Package tui provides the terminal user interface.
Package tui provides the terminal user interface.
Index ¶
- Constants
- Variables
- func CalculateVisibleRange(offset, viewHeight, total int) (start, end int)
- func IsTerminal() bool
- func RenderCheckbox(isChecked bool) string
- func RenderCursor(isSelected bool) string
- func RenderHelp(keys ...string) string
- func RenderHelpFromBindings(width int, bindings ...key.Binding) string
- func RenderHelpWithWidth(width int, keys ...string) string
- func RenderOSInfo(osName string, isArch, dryRun bool) string
- func RenderScrollIndicators(start, end, total int) (string, string)
- func Run(cfg *config.Config, plat *platform.Platform, dryRun bool, configPath string) error
- func RunWithManager(cfg *config.Config, plat *platform.Platform, mgr *manager.Manager, ...) error
- type AddFileMode
- type ApplicationForm
- type ApplicationItem
- type BatchCompleteMsg
- type BatchOperationMsg
- type ConfirmKeyMap
- type DetailKeyMap
- type DiffPickerKeyMap
- type FilePickerKeyMap
- type FilesListKeyMap
- type FormNavKeyMap
- type FormType
- type ListKeyMap
- type ModeChooserKeyMap
- type Model
- type MultiSelectKeyMap
- type Operation
- type OperationCompleteMsg
- type PackageInstallMsg
- type PackageItem
- type PathState
- type ResultItem
- type Screen
- type SearchKeyMap
- type SharedKeyMap
- type SubEntryForm
- type SubEntryItem
- type SuggestionKeyMap
- type SummaryKeyMap
- type TableRow
- type TextEditKeyMap
Constants ¶
const ( KeyEnter = "enter" KeyEsc = "esc" KeyCtrlC = "ctrl+c" KeyCtrlS = "ctrl+s" KeyDown = "down" KeyTab = "tab" KeyShiftTab = "shift+tab" KeyBackspace = "backspace" KeyDelete = "delete" KeyLeft = "left" KeyRight = "right" )
Key binding constants for TUI navigation and interaction
const ( PlaceholderWhen = `e.g., {{ eq .OS "linux" }}` PlaceholderNeovim = "e.g., neovim" PlaceholderGitURL = "e.g., https://github.com/user/repo.git" PlaceholderGitBranch = "e.g., main" PlaceholderGitLinux = "e.g., ~/.local/share/app" PlaceholderGitWindows = "e.g., ~/AppData/Local/app" PlaceholderInstallerLinux = "e.g., curl ... | sh" PlaceholderInstallerWindows = "e.g., winget install ..." PlaceholderInstallerBinary = "e.g., cargo" PlaceholderDep = "e.g., ffmpeg" IndentSpaces = " " CheckboxUnchecked = "[ ]" CheckboxChecked = "[✓]" )
UI element constants
const ( TypeGit = "git" TypeInstaller = "installer" TypeFolder = "folder" TypeNone = "none" )
Entry type constants
const ( StatusInstalled = "Installed" StatusMissing = "Missing" StatusFiltered = "Filtered" StatusOutdated = "Outdated" StatusModified = "Modified" StatusUnknown = "Unknown" StatusLoading = "Loading..." )
Application status constants for level 1 rows
const ( SortColumnName = "name" SortColumnStatus = "status" SortColumnPath = "path" )
Sort column constants
const ( OSLinux = "linux" OSWindows = "windows" )
OS constants
const ( GitFieldURL = 0 GitFieldBranch = 1 GitFieldLinux = 2 GitFieldWindows = 3 GitFieldSudo = 4 GitFieldCount = 5 )
Git package field indices within the git sub-section
const ( InstallerFieldLinux = 0 InstallerFieldWindows = 1 InstallerFieldBinary = 2 InstallerFieldCount = 3 )
Installer package field indices within the installer sub-section
const ( // ScrollOffsetMargin is the minimum number of rows to keep between cursor and viewport edges // Similar to vim's 'scrolloff' setting - provides smooth scrolling with buffer zone ScrollOffsetMargin = 3 )
Scrolling behavior constants
Variables ¶
var ( // BaseStyle is the base style with padding for content. BaseStyle = lipgloss.NewStyle(). Padding(1, 2) // TitleStyle is the main title style with border and bold text. TitleStyle = lipgloss.NewStyle(). Bold(true). Foreground(primaryColor). MarginBottom(1). Padding(0, 1). Border(lipgloss.RoundedBorder()). BorderForeground(primaryColor) // SubtitleStyle is the subtitle style with muted color and italic text. SubtitleStyle = lipgloss.NewStyle(). Foreground(mutedColor). Italic(true). MarginBottom(1) // MutedTextStyle is inline muted text (no margins, for use within lines). MutedTextStyle = lipgloss.NewStyle(). Foreground(mutedColor) // MenuItemStyle is the default menu item style. MenuItemStyle = lipgloss.NewStyle(). Padding(0, 2) // SelectedMenuItemStyle is the style for selected menu items with highlighted background. SelectedMenuItemStyle = lipgloss.NewStyle(). Foreground(textColor). Background(primaryColor). Bold(true) // ListItemStyle is the default list item style. ListItemStyle = lipgloss.NewStyle() // SelectedListItemStyle is the style for selected list items with highlighted background. SelectedListItemStyle = lipgloss.NewStyle(). Foreground(textColor). Background(primaryColor). Bold(true) // CheckedStyle is the style for checked checkboxes. CheckedStyle = lipgloss.NewStyle(). Foreground(secondaryColor). Bold(true) // UncheckedStyle is the style for unchecked checkboxes. UncheckedStyle = lipgloss.NewStyle(). Foreground(mutedColor) // PathNameStyle is the style for path names with bold text. PathNameStyle = lipgloss.NewStyle(). Foreground(textColor). Bold(true) // PathTargetStyle is the style for path target locations with muted italic text. PathTargetStyle = lipgloss.NewStyle(). Foreground(mutedColor). Italic(true) // PathBackupStyle is the style for path backup locations. PathBackupStyle = lipgloss.NewStyle(). Foreground(accentColor) // FolderBadgeStyle is the badge style for folder indicators. FolderBadgeStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#000")). Background(accentColor). Padding(0, 1). MarginLeft(1) // StateBadgeReadyStyle is the badge style for ready state (green background). StateBadgeReadyStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#000")). Background(secondaryColor). Padding(0, 1). MarginLeft(1) // StateBadgeAdoptStyle is the badge style for adopt state (amber background). StateBadgeAdoptStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#000")). Background(accentColor). Padding(0, 1). MarginLeft(1) // StateBadgeMissingStyle is the badge style for missing state (red background). StateBadgeMissingStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#fff")). Background(errorColor). Padding(0, 1). MarginLeft(1) // StateBadgeLinkedStyle is the badge style for linked state (muted text). StateBadgeLinkedStyle = lipgloss.NewStyle(). Foreground(mutedColor). Padding(0, 1). MarginLeft(1) // StateBadgeOutdatedStyle is the badge style for outdated state (amber background). StateBadgeOutdatedStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#000")). Background(accentColor). Padding(0, 1). MarginLeft(1) // StateBadgeModifiedStyle is the badge style for modified state (blue background). StateBadgeModifiedStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#fff")). Background(lipgloss.Color("#3B82F6")). Padding(0, 1). MarginLeft(1) // StateBadgeFilteredStyle is the badge style for filtered state (same as linked - muted). StateBadgeFilteredStyle = lipgloss.NewStyle(). Foreground(mutedColor). Padding(0, 1). MarginLeft(1) // StateBadgeInstalledStyle is the badge style for installed state (muted, like linked). StateBadgeInstalledStyle = lipgloss.NewStyle(). Foreground(mutedColor). Padding(0, 1). MarginLeft(1) // ProgressStyle is the style for progress indicators. ProgressStyle = lipgloss.NewStyle(). Foreground(secondaryColor) // SuccessStyle is the style for success messages with bold green text. SuccessStyle = lipgloss.NewStyle(). Foreground(secondaryColor). Bold(true) // ErrorStyle is the style for error messages with bold red text. ErrorStyle = lipgloss.NewStyle(). Foreground(errorColor). Bold(true) // WarningStyle is the style for warning messages with amber text. WarningStyle = lipgloss.NewStyle(). Foreground(accentColor) // BoxStyle is the default box style with rounded border. BoxStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(primaryColor). Padding(1, 2). MarginTop(1) // ResultBoxStyle is the box style for result displays with green border. ResultBoxStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(secondaryColor). Padding(1, 2). MarginTop(1) // HelpStyle is the style for help text. HelpStyle = lipgloss.NewStyle(). Foreground(mutedColor). MarginTop(1) // HelpKeyStyle is the style for help key bindings with bold amber text. HelpKeyStyle = lipgloss.NewStyle(). Foreground(accentColor). Bold(true) // StatusBarStyle is the style for the status bar. StatusBarStyle = lipgloss.NewStyle(). Foreground(textColor). Background(lipgloss.Color("#1F2937")). Padding(0, 1). MarginTop(1) // SpinnerStyle is the style for loading spinners. SpinnerStyle = lipgloss.NewStyle(). Foreground(primaryColor) // FilterInputStyle is the style for filter input fields. FilterInputStyle = lipgloss.NewStyle(). Foreground(textColor). Background(lipgloss.Color("#1F2937")). Padding(0, 1) // FilterHighlightStyle is the style for highlighted filter matches with amber background. FilterHighlightStyle = lipgloss.NewStyle(). Foreground(mutedColor). Bold(true) // MultiSelectBannerStyle is the style for the multi-select banner showing selection counts. MultiSelectBannerStyle = lipgloss.NewStyle(). Foreground(mutedColor). Bold(true). Padding(0, 2) // SelectedRowStyle is the style for rows that are selected in multi-select mode. // Uses a lighter purple background to differentiate from cursor highlight. SelectedRowStyle = lipgloss.NewStyle(). Foreground(textColor). Background(lipgloss.Color("#9F7AEA")). Padding(0, 1) )
var ConfirmKeys = ConfirmKeyMap{ Yes: key.NewBinding( key.WithKeys("y", "Y", "enter"), key.WithHelp("y/enter", "yes"), ), No: key.NewBinding( key.WithKeys("n", "N", "esc"), key.WithHelp("n/esc", "no"), ), }
ConfirmKeys are the keybindings for confirmation dialogs.
var DetailKeys = DetailKeyMap{ Close: key.NewBinding( key.WithKeys("esc", "enter"), key.WithHelp("h/←/esc", "close"), ), }
DetailKeys are the keybindings for the detail popup.
var DiffPickerKeys = DiffPickerKeyMap{ Up: key.NewBinding( key.WithKeys("up", "k"), key.WithHelp("↑/k", "up"), ), Down: key.NewBinding( key.WithKeys("down", "j"), key.WithHelp("↓/j", "down"), ), Select: key.NewBinding( key.WithKeys("enter"), key.WithHelp("enter", "select"), ), Cancel: key.NewBinding( key.WithKeys("esc"), key.WithHelp("esc", "cancel"), ), }
DiffPickerKeys are the keybindings for the diff picker.
var FilePickerKeys = FilePickerKeyMap{ Toggle: key.NewBinding( key.WithKeys(" ", "tab"), key.WithHelp("space/tab", "toggle"), ), Confirm: key.NewBinding( key.WithKeys("enter"), key.WithHelp("enter", "confirm"), ), Cancel: key.NewBinding( key.WithKeys("esc"), key.WithHelp("esc", "cancel"), ), }
FilePickerKeys are the keybindings for the file picker.
var FilesListKeys = FilesListKeyMap{ Up: key.NewBinding( key.WithKeys("up", "k"), key.WithHelp("↑/k", "up"), ), Down: key.NewBinding( key.WithKeys("down", "j"), key.WithHelp("↓/j", "down"), ), Edit: key.NewBinding( key.WithKeys("enter", " ", "e"), key.WithHelp("e", "edit"), ), Delete: key.NewBinding( key.WithKeys("d", "backspace", "delete"), key.WithHelp("d", "delete"), ), Save: key.NewBinding( key.WithKeys("s", "ctrl+s"), key.WithHelp("s", "save"), ), }
FilesListKeys are the keybindings for the files list.
Up: key.NewBinding( key.WithKeys("up", "k"), key.WithHelp("↑/k", "up"), ), Down: key.NewBinding( key.WithKeys("down", "j"), key.WithHelp("↓/j", "down"), ), TabNext: key.NewBinding( key.WithKeys("tab"), key.WithHelp("tab", "next"), ), TabPrev: key.NewBinding( key.WithKeys("shift+tab"), key.WithHelp("shift+tab", "prev"), ), Edit: key.NewBinding( key.WithKeys("enter", "e"), key.WithHelp("e", "edit"), ), Save: key.NewBinding( key.WithKeys("s", "ctrl+s"), key.WithHelp("s", "save"), ), Cancel: key.NewBinding( key.WithKeys("esc"), key.WithHelp("esc", "cancel"), ), Toggle: key.NewBinding( key.WithKeys(" "), key.WithHelp("space", "toggle"), ), Delete: key.NewBinding( key.WithKeys("d", "backspace", "delete"), key.WithHelp("d", "delete"), ), }
FormNavKeys are the keybindings for form navigation.
var ListKeys = ListKeyMap{ Up: key.NewBinding( key.WithKeys("up", "k"), key.WithHelp("↑/k", "up"), ), Down: key.NewBinding( key.WithKeys("down", "j"), key.WithHelp("↓/j", "down"), ), Expand: key.NewBinding( key.WithKeys("enter", "l", "right"), key.WithHelp("l/→", "expand"), ), Collapse: key.NewBinding( key.WithKeys("h", "left"), key.WithHelp("h/←", "collapse"), ), Search: key.NewBinding( key.WithKeys("/"), key.WithHelp("/", "search"), ), SortByName: key.NewBinding( key.WithKeys("n"), key.WithHelp("n", "name"), ), SortByStatus: key.NewBinding( key.WithKeys("t"), key.WithHelp("t", "status"), ), SortByPath: key.NewBinding( key.WithKeys("p"), key.WithHelp("p", "path"), ), Filter: key.NewBinding( key.WithKeys("f"), key.WithHelp("f", "filter"), ), Edit: key.NewBinding( key.WithKeys("e"), key.WithHelp("e", "edit"), ), AddApp: key.NewBinding( key.WithKeys("A"), key.WithHelp("A", "add app"), ), AddEntry: key.NewBinding( key.WithKeys("a"), key.WithHelp("a", "add entry"), ), Delete: key.NewBinding( key.WithKeys("d", "delete", "backspace"), key.WithHelp("d", "delete"), ), Restore: key.NewBinding( key.WithKeys("r"), key.WithHelp("r", "restore"), ), Install: key.NewBinding( key.WithKeys("i"), key.WithHelp("i", "install"), ), Toggle: key.NewBinding( key.WithKeys("tab", " "), key.WithHelp("tab", "toggle"), ), ShowDetail: key.NewBinding( key.WithKeys("enter", "l", "right"), key.WithHelp("enter", "detail"), ), NewOperation: key.NewBinding( key.WithKeys("r"), key.WithHelp("r", "new operation"), ), QuitOrEnter: key.NewBinding( key.WithKeys("q", "enter"), key.WithHelp("q/enter", "quit"), ), }
ListKeys are the keybindings for the list screen.
var ModeChooserKeys = ModeChooserKeyMap{ Up: key.NewBinding( key.WithKeys("up", "k"), key.WithHelp("↑/k", "up"), ), Down: key.NewBinding( key.WithKeys("down", "j"), key.WithHelp("↓/j", "down"), ), Select: key.NewBinding( key.WithKeys("enter"), key.WithHelp("enter", "select"), ), Cancel: key.NewBinding( key.WithKeys("esc"), key.WithHelp("esc", "cancel"), ), }
ModeChooserKeys are the keybindings for the mode chooser.
var MultiSelectKeys = MultiSelectKeyMap{ Toggle: key.NewBinding( key.WithKeys("tab"), key.WithHelp("tab", "toggle"), ), Clear: key.NewBinding( key.WithKeys("esc"), ), Restore: key.NewBinding( key.WithKeys("r"), key.WithHelp("r", "restore"), ), Install: key.NewBinding( key.WithKeys("i"), key.WithHelp("i", "install"), ), Delete: key.NewBinding( key.WithKeys("d"), key.WithHelp("d", "delete"), ), }
MultiSelectKeys are the keybindings for multi-select mode.
var SearchKeys = SearchKeyMap{ Confirm: key.NewBinding( key.WithKeys("enter"), key.WithHelp("enter", "confirm"), ), Cancel: key.NewBinding( key.WithKeys("esc"), ), }
SearchKeys are the keybindings for search mode.
ForceQuit: key.NewBinding( key.WithKeys("ctrl+c"), key.WithHelp("ctrl+c", "force quit"), ), Quit: key.NewBinding( key.WithKeys("q"), key.WithHelp("q", "quit"), ), }
SharedKeys are available on all screens.
var SuggestionKeys = SuggestionKeyMap{ Up: key.NewBinding( key.WithKeys("up"), key.WithHelp("↑/↓", "select"), ), Down: key.NewBinding( key.WithKeys("down"), key.WithHelp("↑/↓", "select"), ), Accept: key.NewBinding( key.WithKeys("tab", "enter"), key.WithHelp("tab/enter", "accept"), ), Cancel: key.NewBinding( key.WithKeys("esc"), key.WithHelp("esc", "cancel edit"), ), }
SuggestionKeys are the keybindings for suggestion navigation.
var SummaryKeys = SummaryKeyMap{ Confirm: key.NewBinding( key.WithKeys("y", "Y", "enter"), key.WithHelp("y/enter", "confirm"), ), Cancel: key.NewBinding( key.WithKeys("n", "N", "esc"), key.WithHelp("n/esc", "cancel"), ), }
SummaryKeys are the keybindings for the summary screen.
var TextEditKeys = TextEditKeyMap{ Confirm: key.NewBinding( key.WithKeys("enter"), ), Cancel: key.NewBinding( key.WithKeys("esc"), key.WithHelp("esc", "cancel edit"), ), SaveForm: key.NewBinding( key.WithKeys("ctrl+s"), key.WithHelp("ctrl+s", "save field"), ), }
TextEditKeys are the keybindings for text editing mode.
Functions ¶
func CalculateVisibleRange ¶
CalculateVisibleRange calculates the visible range for a scrollable list
func RenderCheckbox ¶
RenderCheckbox renders a checkbox indicator
func RenderCursor ¶
RenderCursor renders a cursor indicator for list items
func RenderHelp ¶
RenderHelp renders help text with key bindings, wrapping to 80 characters. It takes alternating key and description strings and formats them with styling.
func RenderHelpFromBindings ¶
RenderHelpFromBindings generates help text from key.Binding values. It extracts help pairs from each enabled binding and feeds them into the existing RenderHelpWithWidth, preserving the single-char highlight behavior.
func RenderHelpWithWidth ¶
RenderHelpWithWidth renders help text with key bindings, wrapping to the specified width. It takes a width and alternating key and description strings, formatting them with styling. For single-character keys (except "q"), it highlights the matching letter within the description. For "q" and multi-character keys, it renders them separately as "key desc".
func RenderOSInfo ¶
RenderOSInfo renders the OS information subtitle
func RenderScrollIndicators ¶
RenderScrollIndicators renders scroll indicators if needed Returns (topIndicator, bottomIndicator) strings with newlines included
Types ¶
type AddFileMode ¶
type AddFileMode int
AddFileMode represents the current mode for adding files to the files list
const ( // ModeNone indicates no file adding operation is active ModeNone AddFileMode = iota // ModeChoosing indicates user is choosing between browse/type options ModeChoosing // ModePicker indicates file picker is active for browsing ModePicker // ModeTextInput indicates manual text input mode is active ModeTextInput )
type ApplicationForm ¶
type ApplicationForm struct {
// contains filtered or unexported fields
}
ApplicationForm holds state for editing Application metadata
func NewApplicationForm ¶
func NewApplicationForm(app config.Application, isEdit bool) *ApplicationForm
NewApplicationForm creates a new ApplicationForm for testing purposes
func (*ApplicationForm) Validate ¶
func (f *ApplicationForm) Validate() error
Validate checks if the ApplicationForm has valid data
type ApplicationItem ¶
type ApplicationItem struct {
Application config.Application
PkgInstalled *bool
PkgMethod string
SubItems []SubEntryItem
Selected bool
Expanded bool
IsFiltered bool // True if this app doesn't match the current filter context
}
ApplicationItem represents a top-level application with sub-entries
type BatchCompleteMsg ¶
type BatchCompleteMsg struct {
Results []ResultItem // Results for all operations
SuccessCount int // Count of successful operations
FailCount int // Count of failed operations
}
BatchCompleteMsg is sent when the entire batch operation completes.
type BatchOperationMsg ¶
type BatchOperationMsg struct {
ItemName string // Name of the item being processed
ItemIndex int // Current item index (0-based)
TotalItems int // Total number of items
Success bool // Whether this operation succeeded
Message string // Result message
CurrentStep string // Description of current step (e.g., "Restoring nvim-config")
Progress float64 // Overall progress (0.0 to 1.0)
}
BatchOperationMsg is sent for each step of a batch operation. It contains progress information about the current operation.
type ConfirmKeyMap ¶
ConfirmKeyMap defines keybindings for confirmation dialogs.
type DetailKeyMap ¶
DetailKeyMap defines keybindings for the detail popup.
type DiffPickerKeyMap ¶
type DiffPickerKeyMap struct {
Up key.Binding
Down key.Binding
Select key.Binding
Cancel key.Binding
}
DiffPickerKeyMap defines keybindings for the diff file picker.
type FilePickerKeyMap ¶
FilePickerKeyMap defines keybindings for the file picker.
type FilesListKeyMap ¶
type FilesListKeyMap struct {
Up key.Binding
Down key.Binding
Edit key.Binding
Delete key.Binding
Save key.Binding
}
FilesListKeyMap defines keybindings for the files list within forms.
type FormNavKeyMap ¶
type FormNavKeyMap struct {
}
FormNavKeyMap defines keybindings for form navigation (not editing).
type ListKeyMap ¶
type ListKeyMap struct {
Up key.Binding
Down key.Binding
Expand key.Binding
Collapse key.Binding
Search key.Binding
SortByName key.Binding
SortByStatus key.Binding
SortByPath key.Binding
Filter key.Binding
Edit key.Binding
AddApp key.Binding
AddEntry key.Binding
Delete key.Binding
Restore key.Binding
Install key.Binding
Toggle key.Binding
ShowDetail key.Binding
NewOperation key.Binding
QuitOrEnter key.Binding
}
ListKeyMap defines keybindings for the main list/results screen.
type ModeChooserKeyMap ¶
type ModeChooserKeyMap struct {
Up key.Binding
Down key.Binding
Select key.Binding
Cancel key.Binding
}
ModeChooserKeyMap defines keybindings for the file add mode chooser.
type Model ¶
type Model struct {
Config *config.Config
Platform *platform.Platform
Renderer config.PathRenderer
Manager *manager.Manager
ConfigPath string
Applications []ApplicationItem
Operation Operation
Screen Screen
DryRun bool
// contains filtered or unexported fields
}
Model holds the state for the TUI application including configuration, platform information, current screen, operation mode, and UI state.
func NewModel ¶
NewModel creates and initializes a new TUI model with the given configuration, platform information, and dry-run mode. It sets up the initial state including loading entries, detecting path states, and initializing the UI.
func NewModelWithManager ¶
func NewModelWithManager(cfg *config.Config, plat *platform.Platform, mgr *manager.Manager, configPath string) Model
NewModelWithManager creates a model with a manager for real operations
func (Model) Init ¶
Init initializes the TUI model and returns any initial commands to run. This is part of the Bubble Tea model interface.
type MultiSelectKeyMap ¶
type MultiSelectKeyMap struct {
Toggle key.Binding
Clear key.Binding
Restore key.Binding
Install key.Binding
Delete key.Binding
}
MultiSelectKeyMap defines keybindings for the multi-select mode.
type Operation ¶
type Operation int
Operation represents the type of operation being performed in the TUI.
type OperationCompleteMsg ¶
type OperationCompleteMsg struct {
Err error
Results []ResultItem
}
OperationCompleteMsg is sent when an operation completes, containing any error and results from the operation.
type PackageInstallMsg ¶
type PackageInstallMsg struct {
Err error
Message string
Package PackageItem
Success bool
}
PackageInstallMsg is sent after each individual package installation completes
type PackageItem ¶
type PackageItem struct {
Name string
Package *config.EntryPackage
Method string // How it would be installed (pacman, apt, custom, url, none)
Selected bool
}
PackageItem represents a package to be installed, including its name, package configuration, installation method, and selection state.
type PathState ¶
type PathState int
PathState represents the state of a path item for restore operations
const ( // StateLoading indicates state is still being detected StateLoading PathState = iota // StateReady indicates backup exists and is ready to restore StateReady // Backup exists, ready to restore // StateAdopt indicates no backup but target exists (will adopt) StateAdopt // No backup but target exists (will adopt) // StateMissing indicates neither backup nor target exists StateMissing // Neither backup nor target exists // StateLinked indicates already symlinked StateLinked // Already symlinked // StateOutdated indicates linked but template source changed since last render StateOutdated // StateModified indicates linked but rendered file has user edits StateModified )
Path states for restore operations.
type ResultItem ¶
ResultItem represents the result of an operation, including whether it succeeded and any associated message.
type Screen ¶
type Screen int
Screen represents the current screen being displayed in the TUI.
const ( // ScreenProgress is the progress display screen ScreenProgress Screen = iota // ScreenResults is the results display screen ScreenResults // ScreenAddForm is the add/edit form screen ScreenAddForm // ScreenSummary is the summary/confirmation screen for batch operations ScreenSummary )
TUI screen types.
type SearchKeyMap ¶
SearchKeyMap defines keybindings for search mode.
type SharedKeyMap ¶
type SharedKeyMap struct {
}
SharedKeyMap defines keybindings available on all screens.
type SubEntryForm ¶
type SubEntryForm struct {
// contains filtered or unexported fields
}
SubEntryForm holds state for editing SubEntry data
func NewSubEntryForm ¶
func NewSubEntryForm(entry config.SubEntry) *SubEntryForm
NewSubEntryForm creates a new SubEntryForm for testing purposes
func (*SubEntryForm) Validate ¶
func (f *SubEntryForm) Validate() error
Validate checks if the SubEntryForm has valid data
type SubEntryItem ¶
type SubEntryItem struct {
AppName string
Target string
SubEntry config.SubEntry
State PathState
Selected bool
}
SubEntryItem represents a sub-entry within an application (config or git)
type SuggestionKeyMap ¶
type SuggestionKeyMap struct {
Up key.Binding
Down key.Binding
Accept key.Binding
Cancel key.Binding
}
SuggestionKeyMap defines keybindings for autocomplete suggestions.
type SummaryKeyMap ¶
SummaryKeyMap defines keybindings for the summary/confirmation screen.
type TableRow ¶
type TableRow struct {
Data table.Row // Actual display data [name, status, info, path] or [name, status, info, backup, path]
Level int // 0 = application, 1 = sub-entry
TreeChar string // "▶ ", "▼ ", "├─", "└─"
IsExpanded bool
AppIndex int // Index in filtered array (for display)
AppName string // Application name for lookup in m.Applications
SubIndex int // -1 for application rows
State PathState // For badge rendering
StatusAttention bool // Status column needs attention
InfoAttention bool // Info column needs attention
InfoState PathState // Highest-severity sub-entry state (app rows only)
BackupPath string // Backup/source path for sub-entries (empty for app rows)
}
TableRow wraps table.Row with hierarchy metadata
Source Files
¶
- add.go
- app.go
- autocomplete.go
- batch_operations.go
- constants.go
- diff_picker.go
- editor_launch.go
- exec_pause.go
- form_application.go
- form_application_packages.go
- form_shared.go
- form_subentry.go
- form_subentry_filepicker.go
- form_subentry_text.go
- hints.go
- keybindings.go
- model.go
- package_detection.go
- path_utils.go
- progress.go
- selection.go
- snapshot_helpers.go
- state_detection.go
- styles.go
- summary.go
- table_adapter.go
- table_management.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package components provides reusable TUI components.
|
Package components provides reusable TUI components. |