bctui

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(svc blobcache.Service, root blobcache.Handle) *tea.Program

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 Constructor

type Constructor = func() Component

Constructor creates a component

type GLFSComp

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

GLFSComp is a UI component for displaying a GLFS filesystem.

func (*GLFSComp) CopySelected

func (c *GLFSComp) CopySelected() (string, error)

func (*GLFSComp) DoAction

func (c *GLFSComp) DoAction(actx ActionCtx, action Action)

func (*GLFSComp) Init

func (c *GLFSComp) Init(volInfo *blobcache.VolumeInfo)

func (*GLFSComp) InsertKey

func (c *GLFSComp) InsertKey(tea.KeyPressMsg)

func (*GLFSComp) MoveCursor

func (c *GLFSComp) MoveCursor(delta int)

func (*GLFSComp) OpenSelected

func (c *GLFSComp) OpenSelected(context.Context) (string, blobcache.Handle, bool, error)

func (*GLFSComp) Palette

func (c *GLFSComp) Palette() []Binding

func (*GLFSComp) RenderRows

func (c *GLFSComp) RenderRows(width, height int, _ bool) []string

func (*GLFSComp) SetFilter

func (c *GLFSComp) SetFilter(filter string)

func (*GLFSComp) SetState

func (c *GLFSComp) SetState(ctx context.Context, tx *bcsdk.Tx) error

func (*GLFSComp) Shortcuts

func (c *GLFSComp) Shortcuts() []Binding

type Model

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

Model contains all the application state

func (*Model) Init

func (m *Model) Init() tea.Cmd

func (*Model) Update

func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*Model) View

func (m *Model) View() tea.View

type NSComp

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

func (*NSComp) DoAction

func (c *NSComp) DoAction(actx ActionCtx, action Action)

func (*NSComp) Init

func (c *NSComp) Init(volInfo *blobcache.VolumeInfo)

func (*NSComp) InsertKey

func (c *NSComp) InsertKey(msg tea.KeyPressMsg)

func (*NSComp) OpenSelected

func (c *NSComp) OpenSelected(ctx context.Context) (string, blobcache.Handle, bool, error)

func (*NSComp) Palette

func (c *NSComp) Palette() []Binding

func (*NSComp) RenderRows

func (c *NSComp) RenderRows(width, height int, _ bool) []string

func (*NSComp) SchemaName

func (c *NSComp) SchemaName() blobcache.SchemaName

func (*NSComp) SetFilter

func (c *NSComp) SetFilter(filter string)

func (*NSComp) SetInsertMode

func (c *NSComp) SetInsertMode(active bool)

func (*NSComp) SetState

func (c *NSComp) SetState(ctx context.Context, tx *bcsdk.Tx) error

func (*NSComp) Shortcuts

func (c *NSComp) Shortcuts() []Binding

Jump to

Keyboard shortcuts

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