prompter

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Prompter

type Prompter struct {
	*bufio.Reader
	// Questions to ask.
	Questions []string
	// Secret sets the corresponding question to be a secret, hiding input.
	Secret []bool
	// Answers from the user.
	Answers []string
}

Prompter is the interface for prompting the user for input.

func New

func New(q []Question) *Prompter

New creates a new Prompter.

func (*Prompter) Ask

func (pr *Prompter) Ask() error

Ask the user for input.

type Question

type Question struct {
	// Question to present. Include a question mark if necessary.
	Question string
	// Secret sets the question to be a secret, hiding input.
	Secret bool
	// Default answer, if any.
	Default string
}

Question is a question to ask the user.

Jump to

Keyboard shortcuts

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