prompt

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Prompt

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

Prompt prompts for interactive questions.

func New

func New(input io.Reader, output io.Writer) *Prompt

New returns a new prompt.

func (*Prompt) Confirm

func (prompt *Prompt) Confirm(msg, defaultChoice string) error

Confirm prompts for a confirmation, it accepts "yes/no" answers:

  • "y", "yes", "Y", "Yes"
  • "n", "no", "N", "No"

defaultChoice is the default answer to fallback to in case no explicit input is provided (eg. user just pressed ENTER).

func (*Prompt) Input

func (prompt *Prompt) Input(msg string) string

Input prompts for a string input.

func (*Prompt) Password

func (prompt *Prompt) Password(msg string) string

Password prompts for a password. It is similar to input, except that it doesn't echo back to the terminal.

func (*Prompt) Select

func (prompt *Prompt) Select(msg string, choices interface{}) (int, error)

Select allows to pick an item from a list of choices. For example :

Please choose a login provider for your linked cluster:
(1) dcos-uid-password
(2) saml-sp-initiated
(1-2): [...]

Jump to

Keyboard shortcuts

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