picker

package
v0.0.0-...-bd06792 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package picker provides a line-oriented, searchable terminal selector. It deliberately depends only on streams so callers can use terminals, pipes, or deterministic test inputs without terminal-specific state.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Search(reader io.Reader, writer io.Writer, subject string, choices []Choice) (string, error)

Search repeatedly filters choices by a case-insensitive substring and returns the selected value. Exact and sole matches return immediately; ambiguous matches are numbered. It returns an error when choices is empty, input closes before selection, or either stream fails.

Types

type Choice

type Choice struct {
	// Value is the stable text returned for this choice.
	Value string
	// Description adds human-readable search context without changing Value.
	Description string
}

Choice is a selectable value. Description is optional and participates in filtering, but Search returns only Value.

Jump to

Keyboard shortcuts

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