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 ¶
- func New(t theme.Theme) screen.Screen
- type Screen
- func (s *Screen) Actions() action.Set
- func (s *Screen) Help() []key.Binding
- func (s *Screen) Init() tea.Cmd
- func (s *Screen) IsCapturingKeys() bool
- func (s *Screen) Layout() layout.Node
- func (s *Screen) OnEnter(any) tea.Cmd
- func (s *Screen) SetTheme(t theme.Theme)
- func (s *Screen) Title() string
- func (s *Screen) Update(msg tea.Msg) (screen.Screen, tea.Cmd)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
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 ¶
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.