Documentation
¶
Index ¶
- Variables
- func GetFocusedPaneChangedCmd(from, to structure.Position) tea.Cmd
- func NavigateTo(kind resource.Kind, opts ...structure.NavigateOption) tea.Cmd
- func SafeCmd(cmd tea.Cmd) tea.Cmd
- type CacheInterface
- type ErrMakePage
- type ErrMakePageEmptyModel
- type ErrNoMaker
- type Helpers
- type Maker
- type PaneManager
- func (p *PaneManager) FocusedModel() structure.ChildModel
- func (p *PaneManager) FocusedPosition() structure.Position
- func (p *PaneManager) Get(rsc resource.ID) table.EditorInterface
- func (p *PaneManager) HelpBindings() (bindings []*key.Binding)
- func (p *PaneManager) Init() tea.Cmd
- func (p *PaneManager) SetMakerFactory(makerFactory func(kind resource.Kind) Maker)
- func (p *PaneManager) Update(msg tea.Msg) tea.Cmd
- func (p *PaneManager) View() string
Constants ¶
This section is empty.
Variables ¶
var ( ErrAlreadyAtFirstPage = errors.New("already at first page") ErrCannotCloseLastPane = errors.New("cannot close last pane") )
var ( // ErrCommandPanic is returned when a tea.Cmd panics ErrCommandPanic = errors.New("command panic") )
Define static errors
Functions ¶
func NavigateTo ¶
NavigateTo sends an instruction to navigate to a page with the given model kind, and optionally parent resource.
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 ¶
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 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 (p *PaneManager) Get(rsc resource.ID) table.EditorInterface
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) View ¶
func (p *PaneManager) View() string