prompt

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package prompt provides simple interactive prompts for terminal input.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Confirm

func Confirm(question string) bool

Confirm asks a yes/no question and returns true for yes.

func ReadLine

func ReadLine(label string) string

ReadLine prompts for a single line of text input.

func ReadSecret added in v0.3.0

func ReadSecret(label string) string

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

func Select(label string, items []string) string

Select displays a numbered list and lets the user pick one item. Returns the selected item string, or "" if input is invalid.

func SelectMulti

func SelectMulti(label string, items []string) []string

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

func SelectMultiWithDefaults(label string, items []string, defaultIdxs []int) []string

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

func SelectWithOther(label string, items []string, allowOther bool) string

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.

Jump to

Keyboard shortcuts

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