pick

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCanceled = errors.New("canceled")

ErrCanceled is returned when the user cancels an interactive selection.

Functions

func MultiSelect

func MultiSelect[T any](
	title string,
	items []Item[T],
	theme huh.Theme,
	maxHeight int,
	showHelp bool,
	opts ...Option,
) ([]T, error)

MultiSelect presents a multi-select UI and returns the selected values. Returns ErrCanceled if the user cancels. Pass WithFilter to enable "/" filtering of the list.

Types

type Item

type Item[T any] struct {
	Display  string
	Value    T
	Selected bool
}

Item pairs a display string with a value of type T.

type Option

type Option func(*config)

Option configures a selection presented by MultiSelect.

func WithFilter

func WithFilter() Option

WithFilter enables incremental filtering of the list: huh binds "/" to start filtering, typing narrows the visible items, and "esc" clears the filter. Off by default so short lists stay key-for-key simple.

Jump to

Keyboard shortcuts

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