models

package
v0.0.0-...-abce128 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAlreadyAtFirstPage  = errors.New("already at first page")
	ErrCannotCloseLastPane = errors.New("cannot close last pane")
)
View Source
var (
	// ErrCommandPanic is returned when a tea.Cmd panics
	ErrCommandPanic = errors.New("command panic")
)

Define static errors

Functions

func GetFocusedPaneChangedCmd

func GetFocusedPaneChangedCmd(from, to structure.Position) tea.Cmd
func NavigateTo(kind resource.Kind, opts ...structure.NavigateOption) tea.Cmd

NavigateTo sends an instruction to navigate to a page with the given model kind, and optionally parent resource.

func SafeCmd

func SafeCmd(cmd tea.Cmd) tea.Cmd

SafeCmd wraps a tea.Cmd with panic recovery to ensure terminal is properly reset even if the command panics

Types

type CacheInterface

type CacheInterface interface {
	// Get retrieves a model from the cache.
	Get(page structure.Page) structure.ChildModel
	// Put stores a model in the cache.
	Put(page structure.Page, model structure.ChildModel)
	// UpdateAll updates all models in the cache with the given message.
	UpdateAll(msg tea.Msg) []tea.Cmd
	// Update updates a specific model in the cache with the given message.
	Update(key structure.Page, msg tea.Msg) tea.Cmd
}

type ErrMakePage

type ErrMakePage struct {
	Err error
	Msg structure.NavigationMsg
}

func (*ErrMakePage) Error

func (e *ErrMakePage) Error() string

type ErrMakePageEmptyModel

type ErrMakePageEmptyModel struct {
	Msg structure.NavigationMsg
}

func (*ErrMakePageEmptyModel) Error

func (e *ErrMakePageEmptyModel) Error() string

type ErrNoMaker

type ErrNoMaker struct {
	Kind resource.Kind
}

func (*ErrNoMaker) Error

func (e *ErrNoMaker) Error() string

type Helpers

type Helpers struct {
	AppService *services.AppService
}

Helper methods for easily surfacing info in the TUI.

TODO: leverage a cache to enhance performance, particularly if we introduce sqlite at some stage. These helpers are invoked on every render, which for a table with, say 40 visible rows, means they are invoked 40 times a render, which is 40 lookups.

type Maker

type Maker interface {
	Make(id resource.ID, width, height int) (structure.ChildModel, error)
}

Maker makes new models

type PaneManager

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

PaneManager manages the layout of the three panes that compose the Pug full screen terminal app.

func NewPaneManager

func NewPaneManager(
	myStyles *styles.Styles,
	globalKeyMap *keys.GlobalKeyMap,
	paneKeyMap *keys.PaneNavigationKeyMap,
) *PaneManager

NewPaneManager constructs the pane manager with at least the explorer, which occupies the left pane.

func (*PaneManager) FocusedModel

func (p *PaneManager) FocusedModel() structure.ChildModel

FocusedModel retrieves the model of the focused pane.

func (*PaneManager) FocusedPosition

func (p *PaneManager) FocusedPosition() structure.Position

func (*PaneManager) Get

func (*PaneManager) HelpBindings

func (p *PaneManager) HelpBindings() (bindings []*key.Binding)

func (*PaneManager) Init

func (p *PaneManager) Init() tea.Cmd

func (*PaneManager) SetMakerFactory

func (p *PaneManager) SetMakerFactory(makerFactory func(kind resource.Kind) Maker)

func (*PaneManager) Update

func (p *PaneManager) Update(msg tea.Msg) tea.Cmd

func (*PaneManager) View

func (p *PaneManager) View() string

Directories

Path Synopsis
Package editor provides command editing functionality
Package editor provides command editing functionality
top

Jump to

Keyboard shortcuts

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