ui

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Primary interface color - easily modifiable
	PrimaryColor = "#00ADD8" // Official Go logo blue color

	// Secondary colors
	SecondaryColor = "240" // Gray
	ErrorColor     = "1"   // Red
	SuccessColor   = "36"  // Green (for reference if needed)
)

Theme colors

Functions

func NewAddForm

func NewAddForm(hostname string, styles Styles, width, height int, configFile string) *addFormModel

NewAddForm creates a new add form model

func NewEditForm

func NewEditForm(hostName string, styles Styles, width, height int, configFile string) (*editFormModel, error)

NewEditForm creates a new edit form model that supports both single and multi-host editing

func NewFileSelector

func NewFileSelector(title string, styles Styles, width, height int) (*fileSelectorModel, error)

NewFileSelector creates a new file selector for choosing config files

func NewFileSelectorFromBase

func NewFileSelectorFromBase(title string, styles Styles, width, height int, baseConfigFile string) (*fileSelectorModel, error)

NewFileSelectorFromBase creates a new file selector starting from a specific base config file

func NewHelpForm

func NewHelpForm(styles Styles, width, height int) *helpModel

NewHelpForm creates a new help form model

func NewInfoForm

func NewInfoForm(hostName string, styles Styles, width, height int, configFile string) (*infoFormModel, error)

NewInfoForm creates a new info form model for displaying host details in read-only mode

func NewMoveForm

func NewMoveForm(hostName string, styles Styles, width, height int, configFile string) (*moveFormModel, error)

NewMoveForm creates a new move form for moving a host to another config file

func NewPortForwardForm

func NewPortForwardForm(hostName string, styles Styles, width, height int, configFile string, historyManager *history.HistoryManager) *portForwardModel

NewPortForwardForm creates a new port forward form model

func RunAddForm

func RunAddForm(hostname string, configFile string) error

RunAddForm provides backward compatibility for standalone add form

func RunEditForm

func RunEditForm(hostName string, configFile string) error

RunEditForm runs the edit form as a standalone program

func RunInfoForm

func RunInfoForm(hostName string, configFile string) error

RunInfoForm provides a standalone info form for testing

func RunInteractiveMode

func RunInteractiveMode(hosts []config.SSHHost, configFile string, searchMode bool, currentVersion string, noUpdateCheck bool) error

RunInteractiveMode starts the interactive TUI interface

func RunMoveForm

func RunMoveForm(hostName string, configFile string) error

RunMoveForm provides backward compatibility for standalone move form

Types

type Model

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

Model represents the state of the user interface

func NewModel

func NewModel(hosts []config.SSHHost, configFile string, searchMode bool, currentVersion string, noUpdateCheck bool) Model

NewModel creates a new TUI model with the given SSH hosts

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 model updates

func (Model) View

func (m Model) View() string

View renders the complete user interface

type PortForwardType

type PortForwardType int

PortForwardType defines the type of port forwarding

const (
	LocalForward PortForwardType = iota
	RemoteForward
	DynamicForward
)

func (PortForwardType) String

func (p PortForwardType) String() string

type SortMode

type SortMode int

SortMode defines the available sorting modes

const (
	SortByName SortMode = iota
	SortByLastUsed
)

func (SortMode) String

func (s SortMode) String() string

type Styles

type Styles struct {
	// Layout
	App    lipgloss.Style
	Header lipgloss.Style

	// Search styles
	SearchFocused   lipgloss.Style
	SearchUnfocused lipgloss.Style

	// Table styles
	TableFocused   lipgloss.Style
	TableUnfocused lipgloss.Style
	Selected       lipgloss.Style

	// Info and help styles
	SortInfo lipgloss.Style
	HelpText lipgloss.Style

	// Error and confirmation styles
	Error     lipgloss.Style
	ErrorText lipgloss.Style

	// Form styles (for add/edit forms)
	FormTitle     lipgloss.Style
	FormField     lipgloss.Style
	FormHelp      lipgloss.Style
	FormContainer lipgloss.Style
	Label         lipgloss.Style
	FocusedLabel  lipgloss.Style
	HelpSection   lipgloss.Style
}

Styles struct centralizes all lipgloss styles

func NewStyles

func NewStyles(width int) Styles

NewStyles creates a new Styles struct with the given terminal width

type ViewMode

type ViewMode int

ViewMode defines the current view state

const (
	ViewList ViewMode = iota
	ViewAdd
	ViewEdit
	ViewMove
	ViewInfo
	ViewPortForward
	ViewHelp
	ViewFileSelector
)

Jump to

Keyboard shortcuts

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