Documentation ¶
Index ¶
- func Confirm(prompt string) bool
- func FieldIsBoolean(name string, value string) (interface{}, error)
- func FieldIsOptional(name string, value string) (interface{}, error)
- func FieldIsRequired(name string, value string) (interface{}, error)
- func Menu(intro string, t *table.Table, prompt string) interface{}
- type ComplexValue
- type Field
- type FieldProcessor
- type Form
- type Report
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FieldIsBoolean ¶ added in v0.4.1
func FieldIsOptional ¶
func FieldIsRequired ¶
Types ¶
type ComplexValue ¶ added in v0.4.1
type ComplexValue interface { HumanReadable() string // Used to display information to the human operator MachineReadable() interface{} // Used for API requests }
A ComplexValue represents some thing that needs to be displayed one way to a human operator, and another way to a machine (API)
type Field ¶
type Field struct { Label string Name string ShowAs string Value interface{} Processor FieldProcessor Hidden bool }
A Field represents a single piece of information that the operator must enter, usually in the larger context of a Form. Each Field has its own prompt label, internal field name, stored value and processor function for validation / data manipulation.
func (*Field) PromptString ¶ added in v0.4.1
type FieldProcessor ¶ added in v0.4.1
A FieldProcessor is any function that validates, transforms, or replaces a value entered by the operator into a different value. For example, entering a duration as a string, i.e. "4d", might result in a FieldProcessor creating a Duration object representing four days worth of time.
type Form ¶
type Form struct {
Fields []*Field
}
A Form represents a set of Fields that an operator must fill out in order to change some piece of data elsewhere inside of SHIELD.
func (*Form) BuildContent ¶
func (*Form) GetField ¶
GetField retrieves the reference to the Field with the Name attribute given to this function. Returns nil if no such Field was found.