ui

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 8 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 ui is the terminal prompter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Prompter

type Prompter struct {

	// Lang translates the questions and labels; nil is English.
	Lang *core.Language
	// contains filtered or unexported fields
}

Prompter asks questions on a reader/writer pair.

func New

func New(in io.Reader, out io.Writer, disabled bool) *Prompter

New builds a prompter. It is interactive only when stdin is a terminal and prompting was not disabled.

func Scripted

func Scripted(in io.Reader, out io.Writer) *Prompter

Scripted builds an always-interactive prompter for tests.

func (*Prompter) Ask added in v1.7.0

func (p *Prompter) Ask(question string) (string, error)

Ask reads one line of free text. An empty line is an empty answer.

func (*Prompter) Confirm

func (p *Prompter) Confirm(question string, def bool) (bool, error)

Confirm asks a yes/no question.

func (*Prompter) Interactive

func (p *Prompter) Interactive() bool

Interactive reports whether the human can be asked.

func (*Prompter) MultiSelect

func (p *Prompter) MultiSelect(title string, options []ports.Option) ([]int, error)

MultiSelect asks for zero or more options as a comma-separated list.

func (*Prompter) Select

func (p *Prompter) Select(title string, options []ports.Option) (int, error)

Select asks for exactly one option. There is no default: silence is not an answer.

Jump to

Keyboard shortcuts

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