survey

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FormSave     = "<save>"
	FormCancel   = "<cancel>"
	FormDefaults = "<defaults>"
)

Variables

This section is empty.

Functions

func FormShowErrorFn added in v0.4.1

func FormShowErrorFn(err error) error
func MenuShowErrorFn(err error) error

func ValidateNoneEmptyString added in v0.3.1

func ValidateNoneEmptyString(val interface{}) error

func ValidateNoneSpace added in v0.3.1

func ValidateNoneSpace(val interface{}) error

Types

type Bool

type Bool struct {
	*KindMeta
	*ObjectMeta
	// contains filtered or unexported fields
}

func NewBool

func NewBool() *Bool

func (*Bool) Complete

func (c *Bool) Complete() error

func (*Bool) NewKindMeta

func (c *Bool) NewKindMeta() *Bool

func (*Bool) NewObjectMeta

func (c *Bool) NewObjectMeta() *Bool

func (*Bool) Render

func (c *Bool) Render(target interface{}) error

func (*Bool) SetDefault

func (c *Bool) SetDefault(value string) *Bool

func (*Bool) SetHelp

func (c *Bool) SetHelp(value string) *Bool

func (*Bool) SetKind

func (c *Bool) SetKind(value string) *Bool

func (*Bool) SetMessage

func (c *Bool) SetMessage(value string) *Bool

func (*Bool) SetName

func (c *Bool) SetName(value string) *Bool

func (*Bool) SetRequired

func (c *Bool) SetRequired(value bool) *Bool

type Editor

type Editor struct {
	*KindMeta
	*ObjectMeta
	Pattern string
	// contains filtered or unexported fields
}

func NewEditor

func NewEditor() *Editor

func (*Editor) Complete

func (e *Editor) Complete() error

func (*Editor) NewKindMeta

func (e *Editor) NewKindMeta() *Editor

func (*Editor) NewObjectMeta

func (e *Editor) NewObjectMeta() *Editor

func (*Editor) Render

func (e *Editor) Render(target interface{}) error

func (*Editor) SetDefault

func (e *Editor) SetDefault(value string) *Editor

func (*Editor) SetHelp

func (e *Editor) SetHelp(value string) *Editor

func (*Editor) SetKind

func (e *Editor) SetKind(value string) *Editor

func (*Editor) SetMessage

func (e *Editor) SetMessage(value string) *Editor

func (*Editor) SetName

func (e *Editor) SetName(value string) *Editor

func (*Editor) SetPattern

func (e *Editor) SetPattern(value string) *Editor

func (*Editor) SetRequired

func (e *Editor) SetRequired(value bool) *Editor

func (*Editor) SetValidator

func (e *Editor) SetValidator(f func(val interface{}) error) *Editor

type Form added in v0.4.1

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

func NewForm added in v0.4.1

func NewForm(title string) *Form

func (*Form) AddItem added in v0.4.1

func (f *Form) AddItem(title interface{}, fn func() error) *Form

func (*Form) Render added in v0.4.1

func (f *Form) Render() error

func (*Form) SetOnCancelFn added in v0.4.1

func (f *Form) SetOnCancelFn(fn func() error) *Form

func (*Form) SetOnDefaultFn added in v0.4.1

func (f *Form) SetOnDefaultFn(fn func() error) *Form

func (*Form) SetOnErrorFn added in v0.4.1

func (f *Form) SetOnErrorFn(fn func(err error) error) *Form

func (*Form) SetOnSaveFn added in v0.4.1

func (f *Form) SetOnSaveFn(fn func() error) *Form

type Int

type Int struct {
	*KindMeta
	*ObjectMeta
	InvalidOptions        []string
	InvalidOptionsMessage string
	Range                 bool
	Min                   int
	Max                   int
	// contains filtered or unexported fields
}

func NewInt

func NewInt() *Int

func (*Int) Complete

func (i *Int) Complete() error

func (*Int) NewKindMeta

func (i *Int) NewKindMeta() *Int

func (*Int) NewObjectMeta

func (i *Int) NewObjectMeta() *Int

func (*Int) Render

func (i *Int) Render(target interface{}) error

func (*Int) SetDefault

func (i *Int) SetDefault(value string) *Int

func (*Int) SetHelp

func (i *Int) SetHelp(value string) *Int

func (*Int) SetInvalidOptions

func (i *Int) SetInvalidOptions(value []string) *Int

func (*Int) SetInvalidOptionsMessage

func (i *Int) SetInvalidOptionsMessage(value string) *Int

func (*Int) SetKind

func (i *Int) SetKind(value string) *Int

func (*Int) SetMessage

func (i *Int) SetMessage(value string) *Int

func (*Int) SetName

func (i *Int) SetName(value string) *Int

func (*Int) SetRange

func (i *Int) SetRange(min, max int) *Int

func (*Int) SetRequired

func (i *Int) SetRequired(value bool) *Int

func (*Int) SetValidator

func (i *Int) SetValidator(f func(val interface{}) error) *Int

type KindMeta

type KindMeta struct {
	Kind string `json:"kind"`
	// contains filtered or unexported fields
}

func NewKindMeta

func NewKindMeta() *KindMeta

func (*KindMeta) SetKind

func (k *KindMeta) SetKind(value string) *KindMeta

type List

type List struct {
	*KindMeta
	*ObjectMeta
	Options []string
	// contains filtered or unexported fields
}

func NewList

func NewList() *List

func (*List) Complete

func (l *List) Complete() error

func (*List) NewKindMeta

func (l *List) NewKindMeta() *List

func (*List) NewObjectMeta

func (l *List) NewObjectMeta() *List

func (*List) Render

func (l *List) Render(target interface{}) error

func (*List) SetDefault

func (l *List) SetDefault(value string) *List

func (*List) SetHelp

func (l *List) SetHelp(value string) *List

func (*List) SetKind

func (l *List) SetKind(value string) *List

func (*List) SetMessage

func (l *List) SetMessage(value string) *List

func (*List) SetName

func (l *List) SetName(value string) *List

func (*List) SetOptions

func (l *List) SetOptions(value []string) *List

func (*List) SetPageSize added in v0.5.1

func (l *List) SetPageSize(value int) *List

func (*List) SetRequired

func (l *List) SetRequired(value bool) *List

func (*List) SetValidator

func (l *List) SetValidator(f func(val interface{}) error) *List

type ListSelector added in v0.4.0

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

func NewListSelector added in v0.4.0

func NewListSelector(title string) *ListSelector

func (*ListSelector) AddItems added in v0.4.0

func (ls *ListSelector) AddItems(items ...Selector) *ListSelector

func (*ListSelector) Render added in v0.4.0

func (ls *ListSelector) Render() (Selector, error)
type Menu struct {
	// contains filtered or unexported fields
}

func NewMenu added in v0.4.0

func NewMenu(title string) *Menu
func (m *Menu) AddItem(title string, fn func() error) *Menu
func (m *Menu) Render() error
func (m *Menu) SetBackOption(value bool) *Menu
func (m *Menu) SetDisableLoop(value bool) *Menu
func (m *Menu) SetErrorHandler(value func(err error) error) *Menu

type MultiSelectMenu added in v0.5.1

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

func NewMultiSelectMenu added in v0.5.1

func NewMultiSelectMenu(title string) *MultiSelectMenu

func (*MultiSelectMenu) AddItem added in v0.5.1

func (m *MultiSelectMenu) AddItem(title string, fn func() error) *MultiSelectMenu

func (*MultiSelectMenu) Render added in v0.5.1

func (m *MultiSelectMenu) Render() error

func (*MultiSelectMenu) SetErrorHandler added in v0.5.1

func (m *MultiSelectMenu) SetErrorHandler(value func(err error) error) *MultiSelectMenu

type Multiline

type Multiline struct {
	*KindMeta
	*ObjectMeta
	// contains filtered or unexported fields
}

func NewMultiline

func NewMultiline() *Multiline

func (*Multiline) Complete

func (e *Multiline) Complete() error

func (*Multiline) NewKindMeta

func (e *Multiline) NewKindMeta() *Multiline

func (*Multiline) NewObjectMeta

func (e *Multiline) NewObjectMeta() *Multiline

func (*Multiline) Render

func (e *Multiline) Render(target interface{}) error

func (*Multiline) SetDefault

func (e *Multiline) SetDefault(value string) *Multiline

func (*Multiline) SetHelp

func (e *Multiline) SetHelp(value string) *Multiline

func (*Multiline) SetKind

func (e *Multiline) SetKind(value string) *Multiline

func (*Multiline) SetMessage

func (e *Multiline) SetMessage(value string) *Multiline

func (*Multiline) SetName

func (e *Multiline) SetName(value string) *Multiline

func (*Multiline) SetRequired

func (e *Multiline) SetRequired(value bool) *Multiline

func (*Multiline) SetValidator

func (e *Multiline) SetValidator(f func(val interface{}) error) *Multiline

type ObjectMeta

type ObjectMeta struct {
	Name     string `json:"name"`
	Message  string `json:"message"`
	Default  string `json:"default"`
	Help     string `json:"help"`
	Required bool   `json:"required"`
	// contains filtered or unexported fields
}

func NewObjectMeta

func NewObjectMeta() *ObjectMeta

func (*ObjectMeta) SetDefault

func (o *ObjectMeta) SetDefault(value string) *ObjectMeta

func (*ObjectMeta) SetHelp

func (o *ObjectMeta) SetHelp(value string) *ObjectMeta

func (*ObjectMeta) SetMessage

func (o *ObjectMeta) SetMessage(value string) *ObjectMeta

func (*ObjectMeta) SetName

func (o *ObjectMeta) SetName(value string) *ObjectMeta

func (*ObjectMeta) SetRequired

func (o *ObjectMeta) SetRequired(value bool) *ObjectMeta

type Question

type Question interface {
	Complete() error
	Render(target interface{}) error
}

type Selector added in v0.4.0

type Selector interface {
	Key() string
}

type String

type String struct {
	*KindMeta
	*ObjectMeta
	Options               []string
	InvalidOptions        []string
	InvalidOptionsMessage string
	// contains filtered or unexported fields
}

func NewString

func NewString() *String

func (*String) Complete

func (s *String) Complete() error

func (*String) NewKindMeta

func (s *String) NewKindMeta() *String

func (*String) NewObjectMeta

func (s *String) NewObjectMeta() *String

func (*String) Render

func (s *String) Render(target interface{}) error

func (*String) SetDefault

func (s *String) SetDefault(value string) *String

func (*String) SetHelp

func (s *String) SetHelp(value string) *String

func (*String) SetInvalidOptions

func (s *String) SetInvalidOptions(value []string) *String

func (*String) SetInvalidOptionsMessage

func (s *String) SetInvalidOptionsMessage(value string) *String

func (*String) SetKeepFilter added in v0.4.0

func (s *String) SetKeepFilter(value bool) *String

func (*String) SetKind

func (s *String) SetKind(value string) *String

func (*String) SetMessage

func (s *String) SetMessage(value string) *String

func (*String) SetName

func (s *String) SetName(value string) *String

func (*String) SetOptions

func (s *String) SetOptions(value []string) *String

func (*String) SetPageSize added in v0.4.0

func (s *String) SetPageSize(value int) *String

func (*String) SetRequired

func (s *String) SetRequired(value bool) *String

func (*String) SetValidator

func (s *String) SetValidator(f func(val interface{}) error) *String

Jump to

Keyboard shortcuts

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