tui

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDarkPresetName  = "default-dark"
	DefaultLightPresetName = "default-light"
)

DefaultDarkPresetName / DefaultLightPresetName back the implicit default applied when theme_preset is not set; the choice between them is made by looking at the terminal background.

Variables

This section is empty.

Functions

func InitTheme added in v1.6.0

func InitTheme(cfg *config.Config)

InitTheme picks a palette based on the configured preset and any user overrides. Precedence (low to high):

  1. Selected preset's palette
  2. cfg.Theme (shared overrides)
  3. cfg.ThemeDark or cfg.ThemeLight (only the one matching the preset's light/dark classification)

When theme_preset is unset, the default is auto-selected based on the terminal background (default-dark or default-light). Unknown preset names fall back to default-dark.

func ParseSSHString

func ParseSSHString(input string) *config.Connection

ParseSSHString parses various SSH connection string formats: - user@host - user@host:port - host - host:port - ssh user@host - ssh user@host -p port - ssh -p port user@host - ssh://user@host:port

func Run

func Run(cfg *config.Config, version string) error

Types

type ExportItem

type ExportItem struct {
	Connection config.Connection
	Selected   bool
}

ExportItem represents a connection available for export

type ExportModel

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

ExportModel handles the export modal

func NewExportModel

func NewExportModel(connections []config.Connection, width, height int) ExportModel

NewExportModel creates a new export model pre-populated with connections. All items start selected.

func (ExportModel) Cancelled

func (m ExportModel) Cancelled() bool

func (ExportModel) Confirmed

func (m ExportModel) Confirmed() bool

func (ExportModel) HasItems

func (m ExportModel) HasItems() bool

HasItems returns true if there are items to export

func (ExportModel) Init

func (m ExportModel) Init() tea.Cmd

func (ExportModel) OutputPath

func (m ExportModel) OutputPath() string

OutputPath returns the user-specified output file path

func (ExportModel) SelectedConnections

func (m ExportModel) SelectedConnections() []config.Connection

SelectedConnections returns the connections that were selected for export

func (ExportModel) Update

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

func (ExportModel) View

func (m ExportModel) View() string

type FormModel

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

func NewFormModel

func NewFormModel(title string, conn *config.Connection) FormModel

func (FormModel) Cancelled

func (m FormModel) Cancelled() bool

func (FormModel) GetConnection

func (m FormModel) GetConnection() (*config.Connection, error)

func (FormModel) Init

func (m FormModel) Init() tea.Cmd

func (FormModel) IsEditing

func (m FormModel) IsEditing() bool

func (FormModel) OriginalID

func (m FormModel) OriginalID() string

func (FormModel) Submitted

func (m FormModel) Submitted() bool

func (FormModel) Update

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

func (FormModel) View

func (m FormModel) View() string

type HelpModel

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

func NewHelpModel

func NewHelpModel() HelpModel

func (HelpModel) Init

func (m HelpModel) Init() tea.Cmd

func (HelpModel) Update

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

func (HelpModel) View

func (m HelpModel) View() string

type ImportItem

type ImportItem struct {
	Original   string
	Connection config.Connection
	Renamed    bool
	Selected   bool
}

ImportItem represents a connection to be imported

type ImportModel

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

ImportModel handles the SSH config import modal

func NewImportModel

func NewImportModel(existingIDs map[string]bool, sshConfigPath string, hopConfigPath string, width, height int) ImportModel

NewImportModel creates a new import model by parsing SSH config

func (ImportModel) Cancelled

func (m ImportModel) Cancelled() bool

func (ImportModel) Confirmed

func (m ImportModel) Confirmed() bool

func (ImportModel) Error

func (m ImportModel) Error() error

Error returns any error that occurred during parsing

func (ImportModel) HasItems

func (m ImportModel) HasItems() bool

HasItems returns true if there are items to import

func (ImportModel) Init

func (m ImportModel) Init() tea.Cmd

func (ImportModel) SelectedConnections

func (m ImportModel) SelectedConnections() []config.Connection

SelectedConnections returns the connections that were selected for import

func (ImportModel) Update

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

func (ImportModel) View

func (m ImportModel) View() string

type Model

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

func NewModel

func NewModel(cfg *config.Config, version string) Model

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Update

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

func (Model) View

func (m Model) View() string

type Preset added in v1.7.0

type Preset struct {
	Name        string
	Description string
	IsLight     bool
	Theme       Theme
}

Preset is a named palette. Light and dark variants of the same theme are modelled as separate Presets (e.g. "everforest-dark" and "everforest-light") so users see and pick each one explicitly.

func FindPreset added in v1.7.0

func FindPreset(name string) *Preset

FindPreset looks up a preset by case-insensitive name. Returns nil if no preset matches.

func Presets added in v1.7.0

func Presets() []Preset

Presets returns the bundled preset list in display order. Callers must not mutate the returned slice.

type Theme added in v1.6.0

type Theme struct {
	Primary    lipgloss.Color
	Secondary  lipgloss.Color
	Accent     lipgloss.Color
	Success    lipgloss.Color
	Warning    lipgloss.Color
	Error      lipgloss.Color
	Muted      lipgloss.Color
	Selection  lipgloss.Color
	Foreground lipgloss.Color
}

Theme holds the colors used by the TUI styles. Field names map to the keys accepted under theme / theme_dark / theme_light in config.yaml.

type ThemePickerModel added in v1.7.0

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

ThemePickerModel is the modal view for browsing and selecting bundled presets. Navigation triggers a live preview by mutating currentTheme; the snapshot taken at construction time is restored on cancel or after the caller has consumed the model.

func NewThemePickerModel added in v1.7.0

func NewThemePickerModel(cfg *config.Config, width, height int) ThemePickerModel

NewThemePickerModel snapshots the active theme and positions the cursor on the currently configured preset (or the auto-selected default if unset).

func (ThemePickerModel) Cancelled added in v1.7.0

func (m ThemePickerModel) Cancelled() bool

Cancelled reports whether the user pressed esc.

func (ThemePickerModel) Confirmed added in v1.7.0

func (m ThemePickerModel) Confirmed() bool

Confirmed reports whether the user pressed enter.

func (ThemePickerModel) Init added in v1.7.0

func (m ThemePickerModel) Init() tea.Cmd

func (ThemePickerModel) Original added in v1.7.0

func (m ThemePickerModel) Original() Theme

Original returns the theme snapshot taken when the picker opened. Callers use it to restore the theme if persisting the choice fails.

func (ThemePickerModel) SelectedPreset added in v1.7.0

func (m ThemePickerModel) SelectedPreset() string

SelectedPreset returns the name of the preset under the cursor.

func (ThemePickerModel) Update added in v1.7.0

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

func (ThemePickerModel) View added in v1.7.0

func (m ThemePickerModel) View() string

Jump to

Keyboard shortcuts

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