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

filefinder

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package filefinder is a fuzzy picker modal over a list of items, bound to F.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

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

Model is the picker's state. The item and data slices are parallel, so a caller passing lists of different lengths gets matches whose Original is missing.

func New

func New() Model

New returns a hidden picker with no items.

func (*Model) GetSelected

func (m *Model) GetSelected() any

GetSelected returns the data value paired with the highlighted match, or nil when nothing matches.

func (*Model) Hide

func (m *Model) Hide()

Hide closes the picker, keeping the items so a reopen without Show still has them.

func (*Model) IsVisible

func (m *Model) IsVisible() bool

IsVisible reports whether the picker is open, which is how the parent decides to route keys here.

func (*Model) Query

func (m *Model) Query() string

Query returns the current search text.

func (*Model) SelectNext

func (m *Model) SelectNext()

SelectNext moves the cursor down one match, wrapping past the last.

func (*Model) SelectPrev

func (m *Model) SelectPrev()

SelectPrev moves the cursor up one match, wrapping past the first.

func (*Model) SetQuery

func (m *Model) SetQuery(query string)

SetQuery re-runs the fuzzy match and resets the cursor to the top match. It ignores the query when Show was never called, so the cursor also stays put.

func (*Model) Show

func (m *Model) Show(items []string, data []any)

Show opens the picker over items, pairing each with the value at the same index in data, which is what GetSelected returns. The query is cleared and every item matches until SetQuery narrows it.

func (*Model) View

func (m *Model) View(width, _ int) string

View renders the picker centered in the given terminal size, returning the empty string while hidden.

Jump to

Keyboard shortcuts

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