prompts

package
v2.0.0-snapshot...-58e3a78 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPrompts

type IPrompts interface {
	UsernamePassword() (string, string, error)
	KeyPassphrase(string) string
	Password(msg string) string
	PHI() error
	YesNo(msg string) error
	OTP(string) string
}

IPrompts is the interface in which to interact with the user and accept input.

func New

func New() IPrompts

New returns a new instance of IPrompts

type SPrompts

type SPrompts struct{}

SPrompts is a concrete implementation of IPrompts

func (*SPrompts) KeyPassphrase

func (p *SPrompts) KeyPassphrase(filepath string) string

KeyPassphrase prompts a user to enter a passphrase for a named key.

func (*SPrompts) OTP

func (p *SPrompts) OTP(preferredMode string) string

OTP prompts for a one-time password and returns the value.

func (*SPrompts) PHI

func (p *SPrompts) PHI() error

PHI prompts a user to accept liability for downloading PHI to their local machine.

func (*SPrompts) Password

func (p *SPrompts) Password(msg string) string

Password prompts the user for a password displaying the given message. The password will be hidden while typed. A newline is not added to the given message. If a newline is required, it should be part of the passed in string.

func (*SPrompts) UsernamePassword

func (p *SPrompts) UsernamePassword() (string, string, error)

UsernamePassword prompts a user to enter their username and password.

func (*SPrompts) YesNo

func (p *SPrompts) YesNo(msg string) error

YesNo outputs a given message and waits for a user to answer `y/n`. If yes, flow continues as normal. If no, an error is returned. The given message SHOULD contain the string "(y/n)" or some other form of y/n indicating that the user needs to type in y or n. This method does not do that for you. The message will not have a new line appended to it. If you require a newline, add this to the given message.

Jump to

Keyboard shortcuts

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