prompt

package
v2.0.0-beta.2 Latest Latest
Warning

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

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

Documentation

Overview

Package prompt implements the interactive prompts on charmbracelet/huh.

Index

Constants

This section is empty.

Variables

View Source
var ErrCancelled = errors.New("cancelled")

ErrCancelled reports that the user aborted a prompt.

Functions

func Confirm

func Confirm(streams IO, label string) (bool, error)

Confirm asks a yes/no question, defaulting to no.

func Select

func Select(streams IO, label string, options []string, def int) (int, error)

Select asks the user to pick an option and returns its index.

func Text

func Text(streams IO, label, def string) (string, error)

Text asks for a line of input with a default.

Types

type IO

type IO struct {
	In     *bufio.Reader
	ErrOut io.Writer
	RawTTY bool
}

IO carries a prompt's streams. All prompts go to ErrOut (stderr).

RawTTY selects the full-terminal UI and must only be true when stdin is a real terminal; otherwise huh runs in accessible mode reading In and writing ErrOut. On EOF, accessible prompts terminate with their default value rather than hang.

Jump to

Keyboard shortcuts

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