prompt

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Types = map[string]Func{
	"":      WithDefault,
	"wmenu": WithWmenu,
	"fuzzy": WithFuzzy,
}

Types provides a map of prompt types by name

Functions

func WithDefault

func WithDefault(a Args) (int, error)

WithDefault uses the default prompt method

func WithFuzzy added in v0.8.2

func WithFuzzy(a Args) (int, error)

WithFuzzy picks using

func WithWmenu

func WithWmenu(a Args) (int, error)

WithWmenu picks using wmenu

Types

type Args

type Args struct {
	Message string
	Options [][]string
}

Args struct for prompt functions

type Func

type Func func(Args) (int, error)

Func is the signature for prompts

func (Func) Filtered added in v0.9.0

func (f Func) Filtered(list []string, options []string, msg string) (string, error)

Filtered filters options based on a provided slice and then performs a simple prompt

func (Func) Simple added in v0.9.0

func (f Func) Simple(val string, options []string, msg string) (string, error)

Simple returns either the pre-provided selection or the result of a user prompt

Jump to

Keyboard shortcuts

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