tui

package
v0.34.2 Latest Latest
Warning

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

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

Documentation

Overview

Package tui is rig's terminal control plane: one screen per concern (services, logs, metrics, traces, queries, key-value, data, load, manifests, hosts), all driven by the same engine as the CLI. Screens load nothing until opened and refresh only while showing; the service list is one runtime call per refresh.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chat

func Chat(ctx context.Context, a *engine.App, id string) error

Chat opens the UI with the assistant's chat open, on conversation id ("" a new one, "last" the newest).

func CloseSession

func CloseSession(projectDir, id string) error

CloseSession forgets a saved session.

func CurrentTheme added in v0.13.0

func CurrentTheme() string

CurrentTheme is $RIG_THEME, else what `rig theme <name>` chose, else "default".

func Palettes added in v0.30.0

func Palettes() map[string]Theme

Palettes are every theme resolved, light shades filled in, for the web UI.

func PickSession

func PickSession(rows [][]string, close func(i int) error) (int, error)

PickSession is `rig resume`'s chooser: rows are id, kind, saved, what; enter picks one, d closes the selected one (through close), q leaves. It returns the picked row, -1 for none.

func Pinned added in v0.11.0

func Pinned(projectDir string) (id, env string)

Pinned is the session rig opens on (the last one S saved) and its environment; "" for none.

func Resume

func Resume(ctx context.Context, open func(env string) (*engine.App, error), projectDir, id string) error

Resume opens the saved session's environment and the UI as it was.

func Run

func Run(ctx context.Context, a *engine.App) error

func SaveThemeFile added in v0.13.0

func SaveThemeFile(name, from string) (string, error)

SaveThemeFile writes theme name, in full, to the themes folder as a starting point to edit.

func ThemeNames added in v0.13.0

func ThemeNames() []string

ThemeNames are the built-in themes and the files in ~/.config/rig/themes (name.yaml), sorted.

func Unpin added in v0.11.0

func Unpin(projectDir string)

Unpin has rig open fresh again.

func UseTheme added in v0.13.0

func UseTheme(name string) error

UseTheme makes name the theme rig opens with from now on.

Types

type Session

type Session struct {
	ID      string    `json:"id"`
	Env     string    `json:"env"`
	Created time.Time `json:"created"`
	Saved   time.Time `json:"saved"`
	Tab     int       `json:"tab"`
	TabName string    `json:"tab_name,omitempty"`

	LogServices  []string `json:"log_services,omitempty"`
	LogInstances []string `json:"log_instances,omitempty"`
	LogGrep      string   `json:"log_grep,omitempty"`

	Queries   map[string]*spec.Query   `json:"adhoc_queries,omitempty"`
	Scheduled map[string]bool          `json:"scheduled,omitempty"`
	Results   map[string]savedResult   `json:"results,omitempty"`
	Runs      []queryRun               `json:"runs,omitempty"`
	DataPaths map[string][]string      `json:"data_paths,omitempty"`
	Dashboard int                      `json:"dashboard,omitempty"`
	Load      map[string]savedLoadHist `json:"load,omitempty"`

	Sorts    map[string]gridSort `json:"sorts,omitempty"`
	Widths   map[string]int      `json:"widths,omitempty"`
	Drafts   map[string]draft    `json:"drafts,omitempty"`
	Commands []string            `json:"commands,omitempty"`
	Activity []savedJob          `json:"activity,omitempty"`
	Errors   []loggedErr         `json:"errors,omitempty"`

	Views map[string]map[string]string `json:"views,omitempty"`
}

Session is what S saves and `rig resume` brings back: the screen, what each screen was showing, and the query results and history of the run.

func ListSessions

func ListSessions(projectDir string) ([]Session, error)

ListSessions are the project's saved sessions, newest first, without their results.

func LoadSession

func LoadSession(projectDir, id string) (*Session, error)

LoadSession reads a saved session of the project; id "" or "last" is the newest.

func (Session) Summary

func (s Session) Summary() string

Summary is one line about a saved session for listings.

type Theme added in v0.13.0

type Theme struct {
	// Base is the theme this one starts from; a theme file sets only what it changes.
	Base string `yaml:"base,omitempty"`

	Accent   string `yaml:"accent,omitempty"`
	OnAccent string `yaml:"on_accent,omitempty"`
	Green    string `yaml:"green,omitempty"`
	Amber    string `yaml:"amber,omitempty"`
	Red      string `yaml:"red,omitempty"`
	Purple   string `yaml:"purple,omitempty"`

	Light themeShades `yaml:"light,omitempty"`
	// Series are the chart colours, in order.
	Series []string `yaml:"series,omitempty,flow"`
	// contains filtered or unexported fields
}

Theme is the UI's colours. Text, Dim, Placeholder, Panel, Bar and the three backgrounds are for a dark terminal; Light holds their light-terminal values (empty: the default theme's).

func LoadTheme added in v0.13.0

func LoadTheme(name string) (Theme, error)

LoadTheme resolves a theme by name: a file in the themes folder wins over a built-in, and a theme starts from its base (default: "default"), so it needs only the colours it changes.

Directories

Path Synopsis
Command layoutgen writes layouts.go: for every non-Latin xkb layout on this machine, the rune each key gives, mapped back to the US key in the same place.
Command layoutgen writes layouts.go: for every non-Latin xkb layout on this machine, the rune each key gives, mapped back to the US key in the same place.

Jump to

Keyboard shortcuts

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