prompt

package
v0.0.1-testing Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 9 Imported by: 1 module, 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 minimal, line-based interactive prompts written to stderr.

Index

Constants

This section is empty.

Variables

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

ErrCancelled is returned when the user closes stdin (Ctrl-D).

View Source
var ErrNoInput = errors.New("input required but prompting is disabled")

ErrNoInput is returned when a prompt is required but input is not possible.

Functions

This section is empty.

Types

type Prompter

type Prompter interface {
	Input(label, def string) (string, error)
	Password(label string) (string, error)
	Confirm(label string, def bool) (bool, error)
	Select(label string, options []string, def int) (int, error)
}

func New

func New(io *iostreams.IOStreams) Prompter

New returns a Prompter for the given streams. If prompting is not possible, every call returns ErrNoInput.

Jump to

Keyboard shortcuts

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