prompter

package
v2.9.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Choose

func Choose(pr string, options []string) int

Choose given the choice return the option selected

func ChooseWithDefault

func ChooseWithDefault(pr string, defaultValue string, options []string) (string, error)

ChooseWithDefault given the choice return the option selected with a default

func Password

func Password(pr string) string

Password prompt for password which is required

func RequestSecurityCode

func RequestSecurityCode(pattern string) string

RequestSecurityCode request a security code to be entered by the user

func SetPrompter

func SetPrompter(prmpt Prompter)

SetPrompter configure an aternate prompter to the default one

func String

func String(pr string, defaultValue string) string

String prompt for string which is required

func StringRequired

func StringRequired(pr string) string

StringRequired prompt for string which is required

Types

type CliPrompter

type CliPrompter struct {
}

CliPrompter used to prompt for cli input

func NewCli

func NewCli() *CliPrompter

NewCli builds a new cli prompter

func (*CliPrompter) Choose

func (cli *CliPrompter) Choose(pr string, options []string) int

Choose given the choice return the option selected

func (*CliPrompter) ChooseWithDefault

func (cli *CliPrompter) ChooseWithDefault(pr string, defaultValue string, options []string) (string, error)

ChooseWithDefault given the choice return the option selected with a default

func (*CliPrompter) Password

func (cli *CliPrompter) Password(pr string) string

Password prompt for password which is required

func (*CliPrompter) RequestSecurityCode

func (cli *CliPrompter) RequestSecurityCode(pattern string) string

RequestSecurityCode request a security code to be entered by the user

func (*CliPrompter) String

func (cli *CliPrompter) String(pr string, defaultValue string) string

StringRequired prompt for string which is required

func (*CliPrompter) StringRequired

func (cli *CliPrompter) StringRequired(pr string) string

StringRequired prompt for string which is required

type Prompter

type Prompter interface {
	RequestSecurityCode(string) string
	ChooseWithDefault(string, string, []string) (string, error)
	Choose(string, []string) int
	StringRequired(string) string
	String(string, string) string
	Password(string) string
}

Prompter handles prompting user for input

Jump to

Keyboard shortcuts

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