Documentation
¶
Overview ¶
Package tui is the terminal frontend built with Bubble Tea v2.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func KeyActions ¶ added in v0.2.0
func KeyActions() []string
KeyActions lists the action names [keys] accepts, sorted.
func RenderStyles ¶
RenderStyles are the dark output colours; the CLI uses them.
func RenderStylesFor ¶ added in v0.2.0
RenderStylesFor returns the output colours of the dark or light theme.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is the root model.
type Clipboard ¶
type Clipboard interface {
Read() (string, error)
Write(text string) error
UseOSC52() bool // true: copy with tea.SetClipboard (OSC 52)
}
Clipboard is what the TUI needs from the clipboard.
type KeyMap ¶
type KeyMap struct {
NextFocus key.Binding
PrevFocus key.Binding
ToggleSidebar key.Binding
Run key.Binding // F5: non-live tools and large inputs
ClearInput key.Binding // leaves large input mode
CopyOutput key.Binding
PasteInput key.Binding
DetectClip key.Binding
OpenPalette key.Binding
UseOutput key.Binding
EditInput key.Binding
SaveOutput key.Binding
Help key.Binding
Quit key.Binding
QuitOutside key.Binding // "q": only outside text fields
Sidebar sidebar.KeyMap
Options options.KeyMap
Palette palette.KeyMap
}
KeyMap is the TUI's central keymap.
func DefaultKeyMap ¶
func DefaultKeyMap() KeyMap
func (*KeyMap) Apply ¶ added in v0.2.0
Apply overrides bindings with the config's [keys]: each value is one key ("ctrl+y"), several separated by commas ("ctrl+y, alt+c") or "none" to turn the action off. All overrides apply first, so actions can swap keys; then an override whose key another action still uses goes back to its default with a warning, as do unknown actions and empty values.
type Options ¶
type Options struct {
Debounce time.Duration // wait between the last key and the run
Clipboard Clipboard // nil: no clipboard
DetectOnStart bool // --clipboard: detect the clipboard on start
// ToolDefaults are the [tools.<id>] option values from the config.
ToolDefaults map[string]tool.Values
// Limits are the large input thresholds; zero uses DefaultLimits.
Limits workspace.Limits
// Warnings (config problems) are shown in the statusbar on start.
Warnings []string
// Theme is "dark" (also when empty), "light" or "auto", which asks the
// terminal for its background colour.
Theme string
// Mouse turns on clicks and the wheel (config "mouse", on by default).
// The terminal then needs Shift to select text with the mouse.
Mouse bool
// Keys are the [keys] overrides from the config.
Keys map[string]string
// Restore is the previous session from the history: last tool, options
// (over ToolDefaults) and inputs.
Restore history.Session
// Editor builds the external editor command (Ctrl+E); nil uses
// $VISUAL/$EDITOR. Tests replace it.
Editor func(path string) *exec.Cmd
}
Options configures the App.
func DefaultOptions ¶
func DefaultOptions() Options
DefaultOptions are the plan's values (120 ms debounce).
type Theme ¶
type Theme struct {
Dark bool
Frame frame.Styles // the boxes: Tools here, the rest in the workspace
Palette palette.Styles
Status statusbar.Styles
Sidebar sidebar.Styles
Workspace workspace.Styles
Help help.Styles
}
Theme gathers every TUI style. No other file defines colours or inline styles (the colour swatch of render.Swatch is data, not theme).
func LightTheme ¶ added in v0.2.0
func LightTheme() Theme
LightTheme is for terminals with a light background.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package frame draws the boxes that group the TUI sections: a square border with the title inside its top edge.
|
Package frame draws the boxes that group the TUI sections: a square border with the title inside its top edge. |
|
Package palette is the command palette (Ctrl+P): fuzzy search over tools and actions, drawn over the view.
|
Package palette is the command palette (Ctrl+P): fuzzy search over tools and actions, drawn over the view. |
|
Package sidebar shows the registry's categories and tools, with a fuzzy filter opened with "/".
|
Package sidebar shows the registry's categories and tools, with a fuzzy filter opened with "/". |
|
Package statusbar draws the TUI's last row: the active tool's status on the left and the contextual help on the right.
|
Package statusbar draws the TUI's last row: the active tool's status on the left and the contextual help on the right. |
|
Package workspace shows the active tool's options, inputs and output.
|
Package workspace shows the active tool's options, inputs and output. |
|
options
Package options builds a tool's options panel from Spec.Options: Toggle is a checkbox, Select a ◀ ▶ selector and Number or String a validated textinput.
|
Package options builds a tool's options panel from Spec.Options: Toggle is a checkbox, Select a ◀ ▶ selector and Number or String a validated textinput. |