Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Modules = map[string]Module{}
Modules registry must be configured by the running application
Functions ¶
func SplitCommandLine ¶
SplitCommandLine strings on spaces except when a space is within a quoted, bracketed, or braced string. Supports nesting multiple brackets or braces.
Types ¶
type KeyValue ¶
type KeyValue interface { Init() Set(string, string) error Get(string) (string, error) GetDefault(string, string) string Clear() error GetMap() map[string]string }
KeyValue describes our requirements for a key value store
type Module ¶
type Module interface { Args() interface{} Run(ctx *ModuleContext, args interface{}) error }
A Module is a named hook that can perform some task in our script A Script consists of a set of Tasks that use Modules to do work
type ModuleContext ¶
ModuleContext gets passed to modules when they Run Vars provides a KeyValue store to be used by the script Log provides output logging capabilities for the script
type Script ¶ added in v0.2.0
type Script struct { Context *ModuleContext Tasks []Task }
A Script object represents a runnable uinit script A properly initialized scripted can be executed with Run()
func NewScript ¶ added in v0.2.0
NewScript will parse a YAML-formatted documented encoded in `data` If logger == nil, log.Default() will be used.
func NewScriptFromFile ¶ added in v0.2.0
NewScriptFromFile will attempt to read and parse a YAML script in `file` and return a Script object. If logger == nil, log.Default() will be used.
type SimpleKV ¶
type SimpleKV struct {
// contains filtered or unexported fields
}
SimpleKV just provides an interface to a map
func NewSimpleKV ¶
func NewSimpleKV() (kv *SimpleKV)
NewSimpleKV creates a new, initialized SimpleKV
func (*SimpleKV) GetDefault ¶
GetDefault tries to get a named value, sets to dval if it doesn't exist
type Task ¶ added in v0.2.0
A Task is an individual Script item Each task should have at least a Name and Module Most tasks will have Args in a structure defined by the module A task can be executed in a loop if `Loop` is provided, in which case the Args will be templated with {{item}} = current loop value.
func (*Task) Run ¶ added in v0.2.0
func (t *Task) Run(ctx *ModuleContext) (err error)
Run an individual task