variables

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Integer

func Integer(val interface{}) error

Integer allow only integer value

Types

type ConsoleGetter

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

func NewConsoleGetter

func NewConsoleGetter() ConsoleGetter

func (ConsoleGetter) GetValues

func (c ConsoleGetter) GetValues(vars Variables) (answers map[string]interface{}, err error)

type Variable

type Variable struct {
	Name        string       `json:"name,omitempty"        yaml:"name"`
	Message     string       `json:"message,omitempty"     yaml:"message"`
	Help        string       `json:"help,omitempty"        yaml:"help"`
	Default     interface{}  `json:"default,omitempty"     yaml:"default,omitempty"`
	Type        VariableType `json:"type,omitempty"        yaml:"type"`
	Options     []string     `json:"options,omitempty"     yaml:"options,omitempty"`
	Validators  []string     `json:"validators,omitempty"  yaml:"validators,omitempty"`
	Transformer string       `json:"transformer,omitempty" yaml:"transformer,omitempty"`
}

Variable is a representation of input variables in the template

func (Variable) Validate

func (v Variable) Validate() error

Validate variable

type VariableType

type VariableType string
var (
	TextType        VariableType = "text"
	ConfirmType     VariableType = "confirm"
	MultiLineType   VariableType = "multi_line"
	SelectType      VariableType = "select"
	MultiSelectType VariableType = "multi_select"
)

func (VariableType) Validate

func (vt VariableType) Validate() error

type Variables

type Variables []Variable

func (Variables) Validate

func (vars Variables) Validate() error

type VariablesGetter

type VariablesGetter interface {
	GetValues(vars Variables) (map[string]interface{}, error)
}

Jump to

Keyboard shortcuts

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