ui

package
v1.0.32 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PrimaryColor   = "#3B82F6"
	SecondaryColor = "#64748B"
	ErrorColor     = "#EF4444"
	SuccessColor   = "#22C55E"
)

Current theme colors (set by SetTheme)

View Source
var CurrentThemeIndex = 0

CurrentThemeIndex tracks the active theme

View Source
var Themes = []Theme{
	{
		Name:        "Default",
		Primary:     "#3B82F6",
		Secondary:   "#64748B",
		Accent:      "#06B6D4",
		Error:       "#EF4444",
		Success:     "#22C55E",
		Background:  "#0F172A",
		Foreground:  "#F1F5F9",
		SelectionBg: "#1E293B",
		SelectionFg: "#60A5FA",
		Muted:       "#94A3B8",
	},
	{
		Name:        "Dracula",
		Primary:     "#BD93F9",
		Secondary:   "#6272A4",
		Accent:      "#FF79C6",
		Error:       "#FF5555",
		Success:     "#50FA7B",
		Background:  "#282A36",
		Foreground:  "#F8F8F2",
		SelectionBg: "#44475A",
		SelectionFg: "#FF79C6",
		Muted:       "#8894B8",
	},
	{
		Name:        "Nord",
		Primary:     "#88C0D0",
		Secondary:   "#4C566A",
		Accent:      "#81A1C1",
		Error:       "#BF616A",
		Success:     "#A3BE8C",
		Background:  "#2E3440",
		Foreground:  "#D8DEE9",
		SelectionBg: "#3B4252",
		SelectionFg: "#88C0D0",
		Muted:       "#7B88A1",
	},
	{
		Name:        "Monokai",
		Primary:     "#F92672",
		Secondary:   "#75715E",
		Accent:      "#66D9EF",
		Error:       "#F92672",
		Success:     "#A6E22E",
		Background:  "#272822",
		Foreground:  "#F8F8F2",
		SelectionBg: "#3E3D32",
		SelectionFg: "#A6E22E",
		Muted:       "#A09B85",
	},
	{
		Name:        "Solarized Dark",
		Primary:     "#268BD2",
		Secondary:   "#657B83",
		Accent:      "#2AA198",
		Error:       "#DC322F",
		Success:     "#859900",
		Background:  "#002B36",
		Foreground:  "#839496",
		SelectionBg: "#073642",
		SelectionFg: "#93A1A1",
		Muted:       "#93A1A1",
	},
	{
		Name:        "Gruvbox",
		Primary:     "#FE8019",
		Secondary:   "#928374",
		Accent:      "#FABD2F",
		Error:       "#FB4934",
		Success:     "#B8BB26",
		Background:  "#282828",
		Foreground:  "#EBDBB2",
		SelectionBg: "#3C3836",
		SelectionFg: "#FE8019",
		Muted:       "#A89984",
	},
	{
		Name:        "Tokyo Night",
		Primary:     "#7AA2F7",
		Secondary:   "#565F89",
		Accent:      "#BB9AF7",
		Error:       "#F7768E",
		Success:     "#9ECE6A",
		Background:  "#1A1B26",
		Foreground:  "#C0CAF5",
		SelectionBg: "#292E42",
		SelectionFg: "#7AA2F7",
		Muted:       "#9AA5CE",
	},
	{
		Name:        "Catppuccin Mocha",
		Primary:     "#CBA6F7",
		Secondary:   "#9399B2",
		Accent:      "#F5C2E7",
		Error:       "#F38BA8",
		Success:     "#A6E3A1",
		Background:  "#1E1E2E",
		Foreground:  "#CDD6F4",
		SelectionBg: "#313244",
		SelectionFg: "#CBA6F7",
		Muted:       "#9399B2",
	},
	{
		Name:        "One Dark",
		Primary:     "#61AFEF",
		Secondary:   "#5C6370",
		Accent:      "#C678DD",
		Error:       "#E06C75",
		Success:     "#98C379",
		Background:  "#282C34",
		Foreground:  "#ABB2BF",
		SelectionBg: "#3E4451",
		SelectionFg: "#61AFEF",
		Muted:       "#7F848E",
	},
	{
		Name:        "Cyberpunk",
		Primary:     "#00E5FF",
		Secondary:   "#FF00E5",
		Accent:      "#F9F871",
		Error:       "#FF2A6D",
		Success:     "#00FF9C",
		Background:  "#050505",
		Foreground:  "#F0F0F0",
		SelectionBg: "#212121",
		SelectionFg: "#00E5FF",
		Muted:       "#A0A0A0",
	},
	{
		Name:        "Teal Ocean",
		Primary:     "#2DD4BF",
		Secondary:   "#5EEAD4",
		Accent:      "#0D9488",
		Error:       "#FDA4AF",
		Success:     "#6EE7B7",
		Background:  "#132F35",
		Foreground:  "#F0FDFA",
		SelectionBg: "#115E59",
		SelectionFg: "#CCFBF1",
		Muted:       "#6B9CA6",
	},
}

Available themes

Functions

func GetLocalFilesForBrowser

func GetLocalFilesForBrowser(path string) ([]transfer.FileInfo, error)

GetLocalFilesForBrowser returns files in a directory for the file browser

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 NewK8sAddForm added in v1.0.2

func NewK8sAddForm(styles Styles, width, height int) *k8sAddFormModel

NewK8sAddForm creates a new k8s add form

func NewK8sEditForm added in v1.0.2

func NewK8sEditForm(hostName string, styles Styles, width, height int) (*k8sEditFormModel, error)

NewK8sEditForm creates a new k8s edit form with existing host data

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 NewQuickTransfer

func NewQuickTransfer(hostName string, styles Styles, width, height int, configFile string) *quickTransferModel

NewQuickTransfer creates a new quick transfer model

func NewRemoteBrowser

func NewRemoteBrowser(host, startPath, configFile string, mode BrowserMode, styles Styles, width, height int) *remoteBrowserModel

NewRemoteBrowser creates a new remote file browser

func NewSSHKeyUploadForm added in v1.0.11

func NewSSHKeyUploadForm(hostName string, styles Styles, width, height int, configFile string) *sshKeyUploadModel

NewSSHKeyUploadForm creates a new SSH key upload form

func NewThemePicker added in v1.0.2

func NewThemePicker(styles Styles, width, height int, appConfig *config.AppConfig) *themePickerModel

func NewTransferForm

func NewTransferForm(hostName string, styles Styles, width, height int, configFile string, direction transfer.Direction) *transferFormModel

NewTransferForm creates a new transfer 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, currentVersion string) error

RunInteractiveMode starts the interactive TUI interface

func RunMoveForm

func RunMoveForm(hostName string, configFile string) error

RunMoveForm provides backward compatibility for standalone move form

func RunQuickTransfer

func RunQuickTransfer(hostName, configFile string) error

RunQuickTransfer runs the quick transfer UI

func RunRemoteBrowser

func RunRemoteBrowser(host, startPath, configFile string, mode BrowserMode) (string, bool, error)

RunRemoteBrowser runs the remote browser as a standalone TUI and returns the selected path

func RunTransferForm

func RunTransferForm(hostName, configFile string) error

RunTransferForm runs the transfer form as a standalone TUI

func RunTransferFormWithDirection

func RunTransferFormWithDirection(hostName, configFile string, direction transfer.Direction) error

RunTransferFormWithDirection runs the transfer form with a preset direction

func SetTheme added in v1.0.2

func SetTheme(index int)

SetTheme applies a theme by index

func SetThemeByName added in v1.0.2

func SetThemeByName(name string)

SetThemeByName applies a theme by name

Types

type BrowserMode

type BrowserMode int

BrowserMode defines whether we're selecting files or directories

const (
	BrowseFiles BrowserMode = iota
	BrowseDirectories
)

type HostEntry added in v1.0.2

type HostEntry struct {
	Name     string
	IsK8s    bool
	SSHHost  *config.SSHHost
	K8sHost  *config.K8sHost
	Tags     []string
	Hostname string // For display: SSH hostname or K8s namespace/pod
}

HostEntry represents a unified host entry that can be either SSH or K8s

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, currentVersion string) 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 QuickTransferState

type QuickTransferState int

QuickTransferState represents the current state of the quick transfer flow

const (
	QTStateChooseDirection    QuickTransferState = iota
	QTStateChooseUploadType                      // File or Folder selection (only for uploads)
	QTStateChooseDownloadType                    // File or Folder selection (for downloads)
	QTStateSelectingLocal
	QTStateSelectingRemote
	QTStateTransferring
	QTStateError // New state for error with retry option
	QTStateDone
)

type SSHKeyOption added in v1.0.11

type SSHKeyOption int

SSHKeyOption represents a key selection option

const (
	KeyOptionSelect SSHKeyOption = iota
	KeyOptionPaste
)

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

	// Tab styles (for toggle buttons)
	ActiveTab   lipgloss.Style
	InactiveTab lipgloss.Style

	// File browser styles
	DirStyle lipgloss.Style

	// Theme picker styles
	ThemeItem         lipgloss.Style
	ThemeItemSelected lipgloss.Style
	ThemePreview      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 Theme added in v1.0.2

type Theme struct {
	Name        string
	Primary     string
	Secondary   string
	Accent      string
	Error       string
	Success     string
	Background  string
	Foreground  string
	SelectionBg string
	SelectionFg string
	Muted       string
}

Theme represents a color theme for the application

func GetCurrentTheme added in v1.0.2

func GetCurrentTheme() Theme

GetCurrentTheme returns the current theme

type UploadType

type UploadType int

UploadType determines whether to upload a file or folder

const (
	UploadFile UploadType = iota
	UploadFolder
)

type ViewMode

type ViewMode int

ViewMode defines the current view state

const (
	ViewList ViewMode = iota
	ViewAdd
	ViewEdit
	ViewMove
	ViewInfo
	ViewPortForward
	ViewTransfer
	ViewQuickTransfer
	ViewRemoteBrowser
	ViewHelp
	ViewFileSelector
	ViewK8sAdd
	ViewK8sEdit
	ViewTheme
	ViewConnectionError
	ViewSSHKeyUpload
)

Jump to

Keyboard shortcuts

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