Documentation
¶
Overview ¶
Package prompt provides simple interactive prompts for terminal input.
Index ¶
- func Confirm(question string) bool
- func ReadLine(label string) string
- func ReadSecret(label string) string
- func Select(label string, items []string) string
- func SelectMulti(label string, items []string) []string
- func SelectMultiWithDefaults(label string, items []string, defaultIdxs []int) []string
- func SelectWithOther(label string, items []string, allowOther bool) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadSecret ¶ added in v0.3.0
ReadSecret reads input with terminal echo disabled (for tokens/passwords). Falls back to plain ReadLine if stdin is not a terminal.
func Select ¶ added in v0.1.1
Select displays a numbered list and lets the user pick one item. Returns the selected item string, or "" if input is invalid.
func SelectMulti ¶
SelectMulti displays a numbered list and lets the user pick items. Accepts "all" or comma-separated indices (1-based). Returns selected items.
func SelectMultiWithDefaults ¶ added in v0.3.0
SelectMultiWithDefaults is like SelectMulti but pre-selects default indices. defaultIdxs uses 1-based numbering. Pressing Enter accepts the defaults.
func SelectWithOther ¶ added in v0.2.1
SelectWithOther displays a numbered list with an optional "Other" entry. If allowOther is true, an extra option lets the user type a custom value. The user can enter a number, or type text directly:
- With allowOther: non-numeric text is accepted as a freeform value.
- Without allowOther: text is matched (case-insensitive) against the first word of each item (e.g. typing "local" matches "local - Docker Compose...").
Types ¶
This section is empty.