tui

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Title/Header style - cyan, bold
	TitleStyle = renderer.NewStyle().
				Bold(true).
				Foreground(lipgloss.Color("39"))

	// Label style - gray
	LabelStyle = renderer.NewStyle().
				Foreground(lipgloss.Color("245"))

	// Value style - light gray
	ValueStyle = renderer.NewStyle().
				Foreground(lipgloss.Color("252"))

	// Command style - green, bold (for SSH commands)
	CommandStyle = renderer.NewStyle().
					Foreground(lipgloss.Color("42")).
					Bold(true)

	// Footer style - dim gray
	FooterStyle = renderer.NewStyle().
				Foreground(lipgloss.Color("241"))

	// Empty/placeholder style - dim gray, italic
	EmptyStyle = renderer.NewStyle().
				Foreground(lipgloss.Color("241")).
				Italic(true)
)

Common styles used across TUI components

Functions

func FormatSessionDetail added in v0.21.0

func FormatSessionDetail(detail SessionDetail, showHint bool) string

FormatSessionDetail renders a SessionDetail to a string using terminal width

func IsTTY added in v0.21.0

func IsTTY() bool

IsTTY returns whether stdout is a terminal

func PrintSessionDetail added in v0.21.0

func PrintSessionDetail(detail SessionDetail, showHint bool)

PrintSessionDetail prints session detail to stdout

func RunModel added in v0.21.0

func RunModel(model tea.Model) (tea.Model, error)

RunModel runs a bubbletea model with automatic TTY detection. For non-TTY environments, just prints View() once and returns.

Types

type HostSessionConfirmResult

type HostSessionConfirmResult int

HostSessionConfirmResult represents the outcome of a confirmation prompt

const (
	// HostSessionConfirmAccepted indicates the user accepted (pressed 'y')
	HostSessionConfirmAccepted HostSessionConfirmResult = iota
	// HostSessionConfirmRejected indicates the user rejected (pressed 'n')
	HostSessionConfirmRejected
	// HostSessionConfirmInterrupted indicates the user interrupted (pressed Ctrl+C)
	HostSessionConfirmInterrupted
)

type HostSessionModel

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

HostSessionModel handles both session display and confirmation for the host command. It renders the session information and waits for user confirmation (y/n/Ctrl+C) unless auto-accept is enabled.

func NewHostSessionModel

func NewHostSessionModel(detail SessionDetail, autoAccept bool) HostSessionModel

NewHostSessionModel creates a model for displaying session and getting confirmation

func (HostSessionModel) Init

func (m HostSessionModel) Init() tea.Cmd

func (HostSessionModel) Result

Result returns the confirmation result

func (HostSessionModel) Update

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

func (HostSessionModel) View

func (m HostSessionModel) View() string

type SessionDetail added in v0.21.0

type SessionDetail struct {
	IsCurrent        bool
	AdminSocket      string
	SessionID        string
	Command          string
	ForceCommand     string
	Host             string
	SSHCommand       string
	AuthorizedKeys   string
	ConnectedClients []string
}

SessionDetail holds session information for display

type SessionListModel added in v0.21.0

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

SessionListModel provides an interactive session list using bubbles/table

func NewSessionListModel added in v0.21.0

func NewSessionListModel(sessions []SessionDetail) SessionListModel

NewSessionListModel creates a new interactive session list

func (SessionListModel) Init added in v0.21.0

func (m SessionListModel) Init() tea.Cmd

func (SessionListModel) Update added in v0.21.0

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

func (SessionListModel) View added in v0.21.0

func (m SessionListModel) View() string

Jump to

Keyboard shortcuts

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