Documentation
¶
Index ¶
- func New(svc blobcache.Service, root blobcache.Handle) *tea.Program
- type Action
- type ActionCtx
- type Binding
- type Component
- type Constructor
- type GLFSComp
- func (c *GLFSComp) CopySelected() (string, error)
- func (c *GLFSComp) DoAction(actx ActionCtx, action Action)
- func (c *GLFSComp) Init(volInfo *blobcache.VolumeInfo)
- func (c *GLFSComp) InsertKey(tea.KeyPressMsg)
- func (c *GLFSComp) MoveCursor(delta int)
- func (c *GLFSComp) OpenSelected(context.Context) (string, blobcache.Handle, bool, error)
- func (c *GLFSComp) Palette() []Binding
- func (c *GLFSComp) RenderRows(width, height int, _ bool) []string
- func (c *GLFSComp) SetFilter(filter string)
- func (c *GLFSComp) SetState(ctx context.Context, tx *bcsdk.Tx) error
- func (c *GLFSComp) Shortcuts() []Binding
- type Model
- type NSComp
- func (c *NSComp) DoAction(actx ActionCtx, action Action)
- func (c *NSComp) Init(volInfo *blobcache.VolumeInfo)
- func (c *NSComp) InsertKey(msg tea.KeyPressMsg)
- func (c *NSComp) OpenSelected(ctx context.Context) (string, blobcache.Handle, bool, error)
- func (c *NSComp) Palette() []Binding
- func (c *NSComp) RenderRows(width, height int, _ bool) []string
- func (c *NSComp) SchemaName() blobcache.SchemaName
- func (c *NSComp) SetFilter(filter string)
- func (c *NSComp) SetInsertMode(active bool)
- func (c *NSComp) SetState(ctx context.Context, tx *bcsdk.Tx) error
- func (c *NSComp) Shortcuts() []Binding
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Action ¶
type Action string
Action is something that can be done in the application. It is the internal canonical name for the Action regardless of what the keybinding is set to.
type ActionCtx ¶
type ActionCtx struct {
// Invariant: GoTo, SetPreview, and Exit are always non-nil.
// Mode is the current mode that the UI is in.
Mode mode
// SetMode can be used to change the UI mode.
SetMode func(mode)
// IO enqueues an IO operation
IO func(fn tea.Cmd)
// Clipboard writes to the system clipboard.
ClipboardWrite func(string)
// ClipboardRead reads from the system clipboard.
ClipboardRead func() string
// GoTo navigates to another Volume linked from the current one.
GoTo func(name string, lt blobcache.LinkToken)
// SetPreview sets the preview target for the focused component.
SetPreview func(blobcache.LinkToken)
// Exit tells the UI to close this component.
Exit func()
}
type Binding ¶
type Binding struct {
// KeyPress is the key pressed to perform the action.
KeyPress string
// Name is the internal name for the action in the application
Action Action
// Desc is what action is performed.
Desc string
}
Binding is a KeyPress -> Action pair, and a description of the action
type Component ¶
type Component interface {
// Init is called after the volume is first inspected.
Init(volInfo *blobcache.VolumeInfo)
// Update is called to set the internal state of the component using a blobcache transaction
// for the volume.
// This will be called in a tea.Cmd so it is okay if it takes a while
// It will not block the UI.
// The Component should not retain the transaction.
SetState(ctx context.Context, tx *bcsdk.Tx) error
// Do requests that the action be taken.
DoAction(actx ActionCtx, a Action)
// InsertKey handles a keypress while the model is in insert mode.
InsertKey(msg tea.KeyPressMsg)
// Shortcuts are bindings which can be pressed at any time while the Component is focused.
Shortcuts() []Binding
// Palette returns Bindings which correspond to actions that can be performed by the component
Palette() []Binding
// RenderRows renders the component to the terminal
RenderRows(width, height int, focused bool) []string
}
Component renders a blobcache Volume to the terminal
type GLFSComp ¶
type GLFSComp struct {
// contains filtered or unexported fields
}
GLFSComp is a UI component for displaying a GLFS filesystem.
func (*GLFSComp) CopySelected ¶
func (*GLFSComp) Init ¶
func (c *GLFSComp) Init(volInfo *blobcache.VolumeInfo)
func (*GLFSComp) InsertKey ¶
func (c *GLFSComp) InsertKey(tea.KeyPressMsg)
func (*GLFSComp) MoveCursor ¶
func (*GLFSComp) OpenSelected ¶
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model contains all the application state
type NSComp ¶
type NSComp struct {
// contains filtered or unexported fields
}
func (*NSComp) Init ¶
func (c *NSComp) Init(volInfo *blobcache.VolumeInfo)
func (*NSComp) InsertKey ¶
func (c *NSComp) InsertKey(msg tea.KeyPressMsg)
func (*NSComp) OpenSelected ¶
func (*NSComp) SchemaName ¶
func (c *NSComp) SchemaName() blobcache.SchemaName
func (*NSComp) SetInsertMode ¶
Click to show internal directories.
Click to hide internal directories.