picker

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WindowTop    = layout.WindowTop
	WindowBottom = layout.WindowBottom
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Title          string
	Prompt         string
	Matcher        matchers.Matcher
	Sorter         sorters.Sorter
	WindowPosition WindowPosition
	Output         io.Writer
}

Config holds the picker configuration.

type Model

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

func (Model) CursorIndex

func (m Model) CursorIndex() int

func (Model) FilteredItems

func (m Model) FilteredItems() []string

func (Model) Init

func (m Model) Init() tea.Cmd

func (*Model) MoveCursorDown

func (m *Model) MoveCursorDown()

func (*Model) MoveCursorUp

func (m *Model) MoveCursorUp()

func (*Model) PageDown

func (m *Model) PageDown()

func (*Model) PageUp

func (m *Model) PageUp()

func (Model) Query

func (m Model) Query() string

func (*Model) RenderList

func (m *Model) RenderList(reverse bool) []string

func (Model) Result

func (m Model) Result() Result

func (Model) Update

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

func (Model) View

func (m Model) View() string

type Option

type Option func(*Config)

Option configures the picker behavior.

func WithMatcher added in v0.1.2

func WithMatcher(matcher matchers.Matcher) Option

func WithOutput

func WithOutput(output io.Writer) Option

WithOutput sets the output writer used by Bubbletea.

func WithPrompt

func WithPrompt(prompt string) Option

WithPrompt sets the input prompt shown before the query.

func WithSorter added in v0.1.2

func WithSorter(sorter sorters.Sorter) Option

func WithTitle

func WithTitle(title string) Option

WithTitle sets the header line shown above the list.

func WithWindowPosition

func WithWindowPosition(position WindowPosition) Option

WithWindowPosition sets whether the input is above or below the list.

type Result

type Result struct {
	Index int
	Value string
	OK    bool
}

func Run

func Run(items []string, query string, opts ...Option) (Result, error)

type WindowPosition

type WindowPosition = layout.WindowPosition

Directories

Path Synopsis
orderedchars
Package orderedchars matches when all query characters appear in order.
Package orderedchars matches when all query characters appear in order.
substring
Package substring matches when the query exists as a contiguous substring.
Package substring matches when the query exists as a contiguous substring.
minipick
Package minipick sorts matches by width and start position.
Package minipick sorts matches by width and start position.
most_adjacent
Package most_adjacent sorts matches by their most contiguous match span.
Package most_adjacent sorts matches by their most contiguous match span.

Jump to

Keyboard shortcuts

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