includers

package
v0.0.0-...-e502229 Latest Latest
Warning

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

Go to latest
Published: May 30, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cacher

type Cacher interface {
	Cache() map[string]interface{}
}

Cache should return the complete cached contents for all of the variables. .Cache() is used by the built in "include" function for the templates.

type Clearer

type Clearer interface {
	Clear() bool
}

type IncludeManager

type IncludeManager interface {
	Includer
	Included
	Cacher
	Clearer
}

IncludeManager handles including and managing files. The idea is to be able to load your variables for dotfiles from within the template. This gives a few advantages over passing them into the program as flags. Such as; The ability to track requirements, as in, I know what dot files require which variables. This lets you reload specific dot files and systems when only those variables have changed.

type Included

type Included interface {
	Included() map[string][]string
}

Included should return a map of name / path keys with a slice of paths for the values. This is supposed to be a map of dot files, containing a slice of each variable file it requires.

type Includer

type Includer interface {
	Include(path string, origin string) interface{}
}

Includer is used to dynamically load arbitrary data from inside templates. This takes 2 strings, one is 'origin' this is supposed to be the file you import from. This function is not directly exposed to the templates as "include", The templates "include" is a small wrapper that appends 'origin' automagically so that is not required in the templates.

type Parser

type Parser func([]byte) interface{}

type VarIncluder

type VarIncluder struct {
	Paths   map[string][]string
	Parsers map[string]Parser
	Cached  map[string]interface{}
	// contains filtered or unexported fields
}

func NewVarIncluder

func NewVarIncluder(parsers map[string]Parser) *VarIncluder

func (VarIncluder) Cache

func (v VarIncluder) Cache() map[string]interface{}

func (*VarIncluder) Clear

func (v *VarIncluder) Clear() bool

func (VarIncluder) Include

func (v VarIncluder) Include(fpath string, origin string) interface{}

func (VarIncluder) Included

func (v VarIncluder) Included() map[string][]string

func (VarIncluder) SavePath

func (v VarIncluder) SavePath(fpath string, origin string)

Jump to

Keyboard shortcuts

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