picker

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package picker is the CLI's interactive list chooser: a numbered table on stderr, a prompt on stdin. Typing a number picks, typing text filters the list (case-insensitive substring), an empty answer takes the default. No alternate screen, no raw mode — it works in any terminal and is scriptable by piping answers, which is also how the test suite drives it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pick

func Pick(in io.Reader, out io.Writer, title string, items []Item, def int) (int, error)

Pick lets the person choose exactly one item and returns its index. def is the default index (-1 for none).

func PickMulti

func PickMulti(in io.Reader, out io.Writer, title string, items []Item) ([]int, error)

PickMulti lets the person choose several items: "3", "1,4", "2-5", "all", or combinations ("1,3-5"). Returns original indices in list order.

Types

type Item

type Item struct {
	Label  string
	Detail string
}

Item is one selectable row.

Jump to

Keyboard shortcuts

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