tui

package
v1.25.5 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Launch

func Launch() error

Launch starts the interactive TUI dashboard. AltScreen is set on the View so the TUI doesn't pollute scroll-back.

Types

type AddonInfo added in v1.25.5

type AddonInfo struct {
	Name       string
	Version    string
	Repository string
}

AddonInfo is an installed add-on.

type AppModel

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

AppModel is the root Bubble Tea model. It owns what spans the views: the window, the header and footer, the status line, confirmations, the shared containers' health and the refresh ticker. Each view owns its own state and replies to keys with an action that AppModel applies.

func NewAppModel

func NewAppModel() AppModel

NewAppModel creates a new TUI model.

func (AppModel) Init

func (m AppModel) Init() tea.Cmd

Init starts the first load and the refresh ticker. The configuration of the projects is read first, since it shows without waiting for Docker.

func (AppModel) Update

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

Update handles a message, then lays out the views for the result, so a change in the size of the header or footer resizes the body at once.

func (AppModel) View

func (m AppModel) View() tea.View

View renders the TUI on the alternate screen, cut to the window size.

type KeyMap

type KeyMap struct {
	// Navigation. Up and Down move the selection in the project list, Home
	// and End move it or scroll the viewports, which have no keys for that.
	Detail   key.Binding
	Up       key.Binding
	Down     key.Binding
	Home     key.Binding
	End      key.Binding
	PageUp   key.Binding
	PageDown key.Binding
	Back     key.Binding
	Refresh  key.Binding
	Help     key.Binding
	Quit     key.Binding

	// The project list's filter, and the keys that end typing it.
	Filter       key.Binding
	ClearFilter  key.Binding
	AcceptFilter key.Binding
	CancelFilter key.Binding

	// Projects. SSH to Update act only in the detail view.
	Start    key.Binding
	Stop     key.Binding
	Restart  key.Binding
	Delete   key.Binding
	Launch   key.Binding
	Mailpit  key.Binding
	XHGui    key.Binding
	OpenDir  key.Binding
	OpenVSC  key.Binding
	OpenPhpS key.Binding
	SSH      key.Binding
	Logs     key.Binding
	Xdebug   key.Binding
	CopyURL  key.Binding
	Snapshot key.Binding
	Restore  key.Binding
	Update   key.Binding
	StartAll key.Binding
	StopAll  key.Binding
	Poweroff key.Binding
	Config   key.Binding

	// Confirmations of the project keys.
	Confirm  key.Binding
	OmitSnap key.Binding
	Cancel   key.Binding
}

KeyMap defines the TUI's key bindings. The detail and stream views scroll with the viewport's defaults; see viewportKeyMap.

func DefaultKeyMap

func DefaultKeyMap() KeyMap

DefaultKeyMap returns the default key bindings. The key tables in docs/content/users/usage/cli.md list them in the same groups and order, so change them together.

type PortInfo added in v1.25.5

type PortInfo struct {
	Container string
	Host      string
}

PortInfo is a port a service exposes, and the Docker host port it is published on, if any.

type ProjectDetail

type ProjectDetail struct {
	Name            string
	Status          string
	Type            string
	AppRoot         string
	PHPVersion      string
	WebserverType   string
	NodeJSVersion   string
	Docroot         string
	PerformanceMode string
	XHProfMode      string
	DatabaseType    string
	DatabaseVersion string
	// DBOmitted is set when omit_containers leaves the database out.
	DBOmitted bool
	// DockerHost is the address published ports listen on.
	DockerHost string
	// DBHostPort is empty unless the database port is published.
	DBHostPort string
	// DBInternal is the database's address from this project's containers,
	// and DBShared from other projects' containers.
	DBInternal    string
	DBShared      string
	PrimaryURL    string
	URLs          []string
	MailpitURL    string
	XHGuiURL      string
	Router        string
	MutagenStatus string
	Addons        []AddonInfo
	// Snapshots are what `ddev snapshot restore` offers, newest first, so
	// the latest is what --latest restores, even from another git worktree.
	Snapshots []ddevapp.SnapshotRestoreTarget
	Services  []ServiceInfo
	// FromConfig is set while only the configuration is known, without the
	// status, URLs, services and add-ons.
	FromConfig bool
}

ProjectDetail holds what the detail view shows, read from the project's description and installed add-ons.

type ProjectInfo

type ProjectInfo struct {
	Name   string
	Status string
	Type   string
	// URL is the primary URL, set only while the project is running.
	URL     string
	AppRoot string
	// Detail is the part of the detail view the configuration gives, shown
	// until Describe loads the rest.
	Detail *ProjectDetail
}

ProjectInfo holds what the project list shows for a DDEV project.

type ServiceInfo

type ServiceInfo struct {
	Name   string
	Status string
	URL    string
	Ports  []PortInfo
	// Info is the add-on's x-ddev describe-url-port and describe-info.
	Info string
}

ServiceInfo is one of a project's services.

type Styles

type Styles struct {
	Title    lipgloss.Style
	Muted    lipgloss.Style
	Selected lipgloss.Style
	Name     lipgloss.Style
	Match    lipgloss.Style
	URL      lipgloss.Style
	Label    lipgloss.Style
	Section  lipgloss.Style
	Running  lipgloss.Style
	Paused   lipgloss.Style
	Error    lipgloss.Style
	Prompt   lipgloss.Style
	// Info is every message that is not an error or a question. It has no
	// color, which is kept for what needs attention.
	Info     lipgloss.Style
	HelpKey  lipgloss.Style
	HelpDesc lipgloss.Style
}

Styles holds the lipgloss styles used by the TUI. Colors are the terminal's own ANSI colors, or derived from its text and background, so they follow its theme; Bubble Tea drops them where color is off (NO_COLOR).

func NewStyles

func NewStyles(fg, bg color.Color) Styles

NewStyles returns the TUI styles for the terminal's text and background colors, nil while unknown, without colors when simple formatting is configured or colors are disabled.

Jump to

Keyboard shortcuts

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