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 ¶
var ErrBack = errors.New("back")
ErrBack is returned on Esc (with an empty filter): go one screen back. Screens without a parent treat it like ErrCancelled.
var ErrCancelled = errors.New("cancelled")
ErrCancelled is returned on Ctrl-C: leave the whole program.
Functions ¶
func Pick ¶
Pick lets the person choose exactly one item and returns its index: the arrow-key list on a real terminal, the numbered prompt otherwise (piped answers, WEBTOR_PLAIN_PICKER=1, dumb terminals). def is the default index (-1 for none).