prompt

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsInterruptError

func IsInterruptError(err error) bool

IsInterruptError returns true if the given error is a keyboard interrupt error raised by a Prompt.

func MakeLabel

func MakeLabel(option execution.Option) string

func ValidateDate

func ValidateDate(ans interface{}) error

ValidateDate is a survey.Validator that validates if a date is valid.

func ValidateMultiRequired

func ValidateMultiRequired(required bool) survey.Validator

ValidateMultiRequired returns a survey.Validator that validates a multiselect answer if required.

func ValidateStringRequired

func ValidateStringRequired(required bool) survey.Validator

ValidateStringRequired returns a survey.Validator that validates a string answer if required.

Types

type Prompt

type Prompt interface {
	Run() (interface{}, error)
}

Prompt knows how to prompt the user for input, and returns the formatted option value.

func MakePrompt

func MakePrompt(streams *streams.Streams, option execution.Option) (Prompt, error)

MakePrompt returns a general Prompt based on the given Option.

func NewBoolPrompt

func NewBoolPrompt(s *streams.Streams, option execution.Option) Prompt

NewBoolPrompt returns a new Prompt from a Bool option.

func NewDatePrompt

func NewDatePrompt(s *streams.Streams, option execution.Option) Prompt

NewDatePrompt returns a new Prompt from a Date option.

func NewMultiPrompt

func NewMultiPrompt(s *streams.Streams, option execution.Option) Prompt

NewMultiPrompt returns a new Prompt from a Multi option.

func NewSelectPrompt

func NewSelectPrompt(s *streams.Streams, option execution.Option) Prompt

NewSelectPrompt returns a new Prompt from a Select option.

func NewStringPrompt

func NewStringPrompt(s *streams.Streams, option execution.Option) Prompt

NewStringPrompt returns a Prompt from a String option.

Jump to

Keyboard shortcuts

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