Help us shape the future of Go! Take the 2026 Go Developer Survey

optionspicker

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package optionspicker implements the /options overlay. It presents options (auto-approve, auto-compact, session-title). j/k navigate; Enter toggles the highlighted row in place; Esc/q cancels.

A row whose model is unconfigured is marked unavailable and Enter is a no-op on it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CancelMsg

type CancelMsg struct{}

CancelMsg is dispatched when the user presses Escape or q.

type Config

type Config struct {
	AutoApprove  Option
	AutoCompact  Option
	SessionTitle Option
}

Config seeds the picker. Adding a field here and a matching row in init is the only pairing required when a new option is introduced.

type Model

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

Model is the Bubble Tea model for the optionspicker overlay.

func New

func New(cfg Config) Model

New creates an optionspicker initialised with the current session state.

func (Model) Init

func (m Model) Init() tea.Cmd

func (*Model) Reset

func (m *Model) Reset(cfg Config)

Reset re-initialises the picker with fresh state. Call this before showing the overlay to ensure stale state is cleared.

func (*Model) SetSize

func (m *Model) SetSize(width, height int)

SetSize stores the terminal dimensions for the overlay region.

func (Model) Update

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

func (Model) View

func (m Model) View() string

type Option

type Option struct {
	Enabled   bool
	Available bool
}

Option is the on/off/unavailable state of a single /options row.

type ToggleMsg

type ToggleMsg struct {
	Which   Which
	Enabled bool
}

ToggleMsg is dispatched when the user toggles an available row. Enabled is the new state after the toggle. The overlay stays open.

type Which

type Which int

Which identifies the option row that was toggled.

const (
	WhichAutoApprove Which = iota
	WhichAutoCompact
	WhichSessionTitle
)

Source Files

  • optionspicker.go

Jump to

Keyboard shortcuts

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