prompt

package
v0.47.2 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Input

type Input struct {
	// Message is a message to show when asking for an input. e.g. "Which platform to use?"
	Message string
	// TargetPointer is a pointer to the target variable to set the value of the input.
	TargetPointer any
	// Required indicates whether this input is required or not.
	Required bool
}

Input represents an query to ask from users.

type Prompt

type Prompt struct {
	// contains filtered or unexported fields
}

Prompt is a helper for asking inputs from users.

func NewPrompt

func NewPrompt(in io.Reader) Prompt

func (*Prompt) Run

func (p *Prompt) Run(input Input) error

Run asks for an input and set the value to the target pointer.

func (*Prompt) RunSlice

func (p *Prompt) RunSlice(inputs []Input) error

RunSlice sequentially asks for inputs and set the values to the target pointers.

Jump to

Keyboard shortcuts

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