prompt

package
v0.1.25 Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Always

func Always(prompt *Prompt) bool

func AnsweredValueIs

func AnsweredValueIs(prompt *Prompt, key string, value string) bool

func Ask

func Ask(prompt *Prompt, out io.Writer, in io.Reader) error

func BaseOptionValidator

func BaseOptionValidator(p *Prompt, val string) (bool, error)

Types

type Option

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

type Prompt

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

func (*Prompt) AddSubPrompt

func (p *Prompt) AddSubPrompt(prompt *Prompt)

func (*Prompt) AvailableOptions

func (p *Prompt) AvailableOptions() []Option

func (*Prompt) GetAnswer

func (p *Prompt) GetAnswer(key string) string

func (*Prompt) Itr

func (p *Prompt) Itr() func() *Prompt

func (*Prompt) LookupAnswer

func (p *Prompt) LookupAnswer(key string) (string, bool)

func (*Prompt) Record

func (p *Prompt) Record(answer string) bool

func (*Prompt) String

func (p *Prompt) String() string

func (*Prompt) VarMap

func (p *Prompt) VarMap() map[string]string

VarMap returns a _copy_ of the variable map

type PromptBuilder

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

func NewPromptBuilder

func NewPromptBuilder() *PromptBuilder

func (*PromptBuilder) AddDefaultOption

func (b *PromptBuilder) AddDefaultOption(text string) *PromptBuilder

func (*PromptBuilder) AddOption

func (b *PromptBuilder) AddOption(text string) *PromptBuilder

func (*PromptBuilder) AskWhen

func (b *PromptBuilder) AskWhen(filter PromptFilterFunc) *PromptBuilder

func (*PromptBuilder) Build

func (b *PromptBuilder) Build() (*Prompt, error)

func (*PromptBuilder) Context

func (b *PromptBuilder) Context(ctx *PromptsContext) *PromptBuilder

func (*PromptBuilder) Path

func (b *PromptBuilder) Path(p string) *PromptBuilder

func (*PromptBuilder) Text

func (b *PromptBuilder) Text(t string) *PromptBuilder

func (*PromptBuilder) Textf

func (b *PromptBuilder) Textf(format string, a ...interface{}) *PromptBuilder

func (*PromptBuilder) WithLogging

func (b *PromptBuilder) WithLogging() *PromptBuilder

func (*PromptBuilder) WithOptions

func (b *PromptBuilder) WithOptions(optionFunc ValueGetter) *PromptBuilder

func (*PromptBuilder) WithValidator

func (b *PromptBuilder) WithValidator(f ValidatorFunc) *PromptBuilder

type PromptFilterFunc

type PromptFilterFunc func(prompt *Prompt) bool

type PromptsContext

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

func NewPromptsContext

func NewPromptsContext() *PromptsContext

NewPromptsContext creates a new PromptsContext

func (*PromptsContext) Lookup

func (c *PromptsContext) Lookup(key string) (string, bool)

func (*PromptsContext) Set

func (c *PromptsContext) Set(key string, value string)

Set sets the value of the given key

type ValidatorFunc

type ValidatorFunc func(*Prompt, string) (bool, error)

type ValueGetter

type ValueGetter func() ([]string, error)

func ListValues

func ListValues(vals []string) ValueGetter

func YesNo

func YesNo() ValueGetter

Jump to

Keyboard shortcuts

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