prompter

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: May 18, 2021 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Prompter

type Prompter interface {
	// PromptChoice synchronously prompts user to choose an option from a list
	PromptChoice(ctx context.Context, message string, choices []string) (int, error)
	// PromptText synchronously prompts a user to enter some text
	PromptText(ctx context.Context, message string) (string, error)
	// Requests returns a channel to listen for prompt requests
	Requests() <-chan Request
	// Respond submits a response to a previously issued prompt
	Respond(resp Response)
}

func New

func New() Prompter

type Request

type Request struct {
	Message string
	Text    bool
	Choices []string
}

type Response

type Response struct {
	Text   string
	Choice int
	Err    error
}

Jump to

Keyboard shortcuts

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