Documentation ¶
Index ¶
- type IPrompts
- type SPrompts
- func (p *SPrompts) CaptureInput(msg string) string
- func (p *SPrompts) EmailPassword(existingEmail, existingPassword string) (string, string, error)
- func (p *SPrompts) GenericPrompt(msg, prompt string, validOptions []string) string
- func (p *SPrompts) KeyPassphrase(filepath string) string
- func (p *SPrompts) OTP(preferredMode string) string
- func (p *SPrompts) PHI() error
- func (p *SPrompts) Password(msg string) string
- func (p *SPrompts) YesNo(msg, prompt string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IPrompts ¶
type IPrompts interface { EmailPassword(existingEmail, existingPassword string) (string, string, error) KeyPassphrase(string) string Password(msg string) string PHI() error YesNo(msg, prompt string) error OTP(string) string GenericPrompt(msg, prompt string, validOptions []string) string CaptureInput(msg string) string }
IPrompts is the interface in which to interact with the user and accept input.
type SPrompts ¶
type SPrompts struct{}
SPrompts is a concrete implementation of IPrompts
func (*SPrompts) CaptureInput ¶
CaptureInput prompts the user with the given msg and reads input until a newline is encountered. The input is returned with newlines stripped. The prompt and the input will be on the same line when shown to the user.
func (*SPrompts) EmailPassword ¶
EmailPassword prompts a user to enter their email and password.
func (*SPrompts) GenericPrompt ¶
GenericPrompt prompts the user and validates the input against the list of given case-insensitive valid options. The user's choice is returned.
func (*SPrompts) KeyPassphrase ¶
KeyPassphrase prompts a user to enter a passphrase for a named key.
func (*SPrompts) PHI ¶
PHI prompts a user to accept liability for downloading PHI to their local machine.
func (*SPrompts) Password ¶
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) YesNo ¶
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.