prompt

package
v0.0.0-...-91415d8 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyOptions = errors.New("list of provided options is empty")

ErrEmptyOptions indicates the input options list was empty.

Functions

This section is empty.

Types

type ConfirmOption

type ConfirmOption func(*survey.Confirm)

func WithTrueDefault

func WithTrueDefault() ConfirmOption

type GetOption

type GetOption func(*survey.Input)

GetOption is a functional option to modify the Get prompt.

func WithDefaultInput

func WithDefaultInput(s string) GetOption

WithDefaultInput sets a default message for the input.

type Prompt

type Prompt func(survey.Prompt, interface{}, ...survey.AskOpt) error

Prompt abstracts the survey.Askone function.

func New

func New() Prompt

New returns an Prompt with default configuration.

func (Prompt) Confirm

func (p Prompt) Confirm(message, help string, opts ...ConfirmOption) (bool, error)

Confirm prompts the user with a yes/no option.

func (Prompt) Get

func (p Prompt) Get(message, help string, validator ValidatorFunc, opts ...GetOption) (string, error)

Get prompts the user for free-form text input.

func (Prompt) GetSecret

func (p Prompt) GetSecret(message, help string) (string, error)

GetSecret prompts the user for sensitive input. Wraps survey.Password

func (Prompt) SelectOne

func (p Prompt) SelectOne(message, help string, options []string) (string, error)

SelectOne prompts the user with a list of options to choose from with the arrow keys.

type ValidatorFunc

type ValidatorFunc func(interface{}) error

ValidatorFunc defines the function signature for validating inputs.

Jump to

Keyboard shortcuts

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