actions

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package actions demonstrates pkg/action end to end: a screen declares what can be done to the current selection, and the app shell does everything else.

Press "a" or right-click a row. The menu opens beside the rows, titled with what it will act on. Pick a verb and it runs in the background: the TUI stays yours, the output streams into the console under the action's label as a single event, the badge carries ⟳ while it works, and "o" then "x" cancels it.

This screen is deliberately single-target. Marking (list.Options.Markable) and the Multi arity gate are real and tested, but demonstrating them here made the screen teach two things at once and neither read clearly — a reader met it as a menu demo and never discovered the other half. They belong in an example whose subject they are.

What this screen does not contain

No menu. No confirm modal. No goroutine, context, buffer or result message. No mouse handling. No logging. All of that is app.Options.ActionsKey plus the shell — this screen's entire contribution is Actions() below, which is a list of labels and functions.

Exclusive is the field worth understanding here: it says the verb must not overlap a run of itself on the same target, and the menu renders it as "already running" rather than silently dropping the press. Start a Restart and reopen the menu while it works.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(t theme.Theme) screen.Screen

New returns the actions demo's root screen.

Types

type Screen

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

Screen is an ordinary screen with an ordinary list. The only thing that makes it actionable is the Actions method.

func (*Screen) Actions

func (s *Screen) Actions() action.Set

Actions satisfies action.Provider — the whole of this screen's contribution.

It is rebuilt per call, so it always reports on whatever is selected right now. Selection() is the cursor row here; on a markable list it would be the marked set instead, which is why this reads the same either way.

func (*Screen) Help

func (s *Screen) Help() []key.Binding

Help does not mention the actions key: the shell advertises that itself, and only on screens where the menu would actually open. Nor does it mention the individual verbs — moving those off the footer is the entire point.

func (*Screen) Init

func (s *Screen) Init() tea.Cmd

func (*Screen) IsCapturingKeys

func (s *Screen) IsCapturingKeys() bool

func (*Screen) Layout

func (s *Screen) Layout() layout.Node

func (*Screen) OnEnter

func (s *Screen) OnEnter(any) tea.Cmd

func (*Screen) SetTheme

func (s *Screen) SetTheme(t theme.Theme)

func (*Screen) Title

func (s *Screen) Title() string

func (*Screen) Update

func (s *Screen) Update(msg tea.Msg) (screen.Screen, tea.Cmd)

Jump to

Keyboard shortcuts

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