tui

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PurpleHaze   = style.PurpleHaze
	CrimsonPulse = style.CrimsonPulse
	SunsetGlow   = style.SunsetGlow
)

Primary Colors

View Source
var (
	OceanTide  = style.OceanTide
	OceanSurge = style.OceanSurge
	OceanDepth = style.OceanDepth
	OceanAbyss = style.OceanAbyss
	HotPink    = style.HotPink
	NeonGreen  = style.NeonGreen
)

Accent Colors (Maestro-Specific)

View Source
var (
	GhostWhite = style.GhostWhite
	SilverMist = style.SilverMist
	DimGray    = style.DimGray
	DeepSpace  = style.DeepSpace
)

Grayscale

View Source
var (
	FocusedBorder   = style.FocusedBorder
	UnfocusedBorder = style.UnfocusedBorder
)

Focus

View Source
var (
	GetOceanTideShade = style.GetOceanTideShade
	GetDaemonShade    = style.GetDaemonShade
)

Re-export functions

Functions

func Run

func Run(containerPrefix string, cachedState *CachedState) (*TUIResult, *CachedState, error)

Run launches the TUI and returns the result and final state Pass cached state from previous run for instant rendering

Types

type ActionType

type ActionType int

ActionType defines what action the TUI wants the caller to perform

const (
	ActionNone ActionType = iota
	ActionQuit
	ActionConnect    // Connect to a container
	ActionEditConfig // Edit config file
	ActionRunCommand // Run a CLI command
	ActionCreate     // Create a new container
	ActionRunAuth    // Run maestro auth command
)

type CachedState

type CachedState struct {
	Containers []container.Info
	CursorPos  int
}

CachedState holds TUI state for seamless return

type ConfirmActionMsg

type ConfirmActionMsg struct {
	Action        container.OperationType
	ContainerName string
}

ConfirmActionMsg signals that a confirmed action should be executed

type ContainerActionMsg

type ContainerActionMsg struct {
	Action        container.OperationType
	ContainerName string
}

ContainerActionMsg signals a container action should be performed

type Modal struct {
	Type           ModalType
	Title          string
	Content        string        // Main content (can be multi-line) - used if viewport is nil
	Width          int           // Modal width (0 = auto)
	Height         int           // Modal height (0 = auto)
	Actions        []ModalAction // Buttons
	SelectedAction int           // Currently selected action index

	DisableEsc bool // Disable Esc key for modal dismissal (for wizard)
	// contains filtered or unexported fields
}

Modal represents a modal dialog

func NewConfirmModal

func NewConfirmModal(title, content string, onConfirm, onCancel func() tea.Msg) *Modal

NewConfirmModal creates a confirmation modal

func NewErrorModal

func NewErrorModal(title, content string) *Modal

NewErrorModal creates an error modal

func NewInfoModal

func NewInfoModal(title, content string) *Modal

NewInfoModal creates an info modal

func NewLoadingModal

func NewLoadingModal(title, message string, determinate bool) *Modal

NewLoadingModal creates a loading modal with progress or spinner

func NewScrollableHelpModal

func NewScrollableHelpModal(title, content string, contentHeight int) *Modal

NewScrollableHelpModal creates a help modal with scrollable content

func NewScrollableInfoModal

func NewScrollableInfoModal(title, content string, contentHeight int) *Modal

NewScrollableInfoModal creates an info modal with scrollable content

func NewScrollableInfoModalWide

func NewScrollableInfoModalWide(title, content string, contentHeight, width int) *Modal

NewScrollableInfoModalWide creates an info modal with scrollable content and custom width

func (*Modal) GetContextHelp

func (m *Modal) GetContextHelp() []key.Binding

GetContextHelp returns context-specific help bindings based on modal state Returns nil if the modal doesn't support context-specific help

func (*Modal) Init

func (m *Modal) Init() tea.Cmd

Init starts the spinner animation for loading modals

func (*Modal) RenderWithBackground

func (m *Modal) RenderWithBackground(background string, screenWidth, screenHeight int) string

RenderWithBackground renders modal centered on dimmed background

func (*Modal) SetProgress

func (m *Modal) SetProgress(percent float64) tea.Cmd

SetProgress updates the progress bar percentage (0.0 to 1.0)

func (*Modal) Update

func (m *Modal) Update(msg tea.Msg) (*Modal, tea.Cmd)

Update handles input for the modal

func (*Modal) View

func (m *Modal) View(screenWidth, screenHeight int) string

View renders just the modal box (not placed)

type ModalAction

type ModalAction struct {
	Label     string
	Key       string // Keyboard shortcut (e.g., "y", "n", "enter")
	IsPrimary bool   // Primary actions highlighted
	OnSelect  func() tea.Msg
}

ModalAction represents a button in the modal

type ModalType

type ModalType int

ModalType defines the type of modal

const (
	ModalNone             ModalType = iota
	ModalInfo                       // Information message
	ModalError                      // Error message (Crimson Pulse)
	ModalConfirm                    // Yes/No confirmation
	ModalHelp                       // Help/keybindings
	ModalActions                    // Container actions menu
	ModalContainerDetails           // Container info (i key)
	ModalLoading                    // Loading with progress bar
	ModalForm                       // Interactive form with multiple fields
)

type Model

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

Model is the main TUI model

func New

func New(containerPrefix string) *Model

New creates a new TUI model

func NewWithCache

func NewWithCache(containerPrefix string, cached *CachedState) *Model

NewWithCache creates a new TUI model with optional cached state

func (Model) GetResult

func (m Model) GetResult() *TUIResult

GetResult returns the TUI result after it exits

func (Model) GetState

func (m Model) GetState() *CachedState

GetState exports the current state for caching

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 messages and updates state

func (Model) View

func (m Model) View() string

type TUIResult

type TUIResult struct {
	Action          ActionType
	ContainerName   string
	FilePath        string
	TaskDescription string // For ActionCreate
	BranchName      string // For ActionCreate
	NoConnect       bool   // For ActionCreate
	Exact           bool   // For ActionCreate
}

TUIResult is returned when the TUI exits, telling the caller what action to take

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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