templates

package
Version: v2.4.0+incompatible Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	TEMPLATEERROR_UNKNOWN     = iota
	TEMPLATEERROR_BAD_FILE    = iota
	TEMPLATEERROR_PERMISSIONS = iota
	TEMPLATEERROR_NO_TEMPLATE = iota
)
View Source
const ARCH_PREFIX = "ARCH_"
View Source
const DEFAULT_OUTPUT_FILE_PERMS = 0664
View Source
const MAX_FILE_SIZE = 1024 * 1024 // one 1MB - if a config file is bigger than that then its rediculous

Variables

This section is empty.

Functions

This section is empty.

Types

type FileTemplateTicket

type FileTemplateTicket struct {
	Filemode os.FileMode
	// contains filtered or unexported fields
}

our work ticket

func NewFileOp

func NewFileOp(name string, sourcepath string, sourcestring string, targetpath string, dict *TemplateVarDictionary) (ret *FileTemplateTicket)

func (*FileTemplateTicket) GetOpName

func (this *FileTemplateTicket) GetOpName() string

func (*FileTemplateTicket) MaybeGenerateFile

func (this *FileTemplateTicket) MaybeGenerateFile() (err error, wrotefile bool, current string)

func (*FileTemplateTicket) ProcessTemplateFile

func (this *FileTemplateTicket) ProcessTemplateFile() (err error)

type TemplateError

type TemplateError struct {
	TemplateName string
	Code         int
	ErrString    string
}

func (*TemplateError) Error

func (this *TemplateError) Error() string

type TemplateVarDictionary

type TemplateVarDictionary struct {
	Map map[string]string
}

func NewTemplateVarDictionary

func NewTemplateVarDictionary() (ret *TemplateVarDictionary)

func (*TemplateVarDictionary) Add

func (dict *TemplateVarDictionary) Add(key string, value string)

func (*TemplateVarDictionary) AddArch

func (dict *TemplateVarDictionary) AddArch(key string, value string)

func (*TemplateVarDictionary) AddTaggedStruct

func (dict *TemplateVarDictionary) AddTaggedStruct(strct interface{}) (numadded int, err error)

AddTaggedStruct adds a structure of tagged items in a struct. Only string fields are added, and only public fields. An example would be: type Example struct {

Stuff string `dict:"STUFF"`

} In this case the tag "STUFF" would be added, with whatever value it's assigned.

func (*TemplateVarDictionary) AddTaggedStructArch

func (dict *TemplateVarDictionary) AddTaggedStructArch(strct interface{}) (numadded int, err error)

AddTaggedStructArch adds a structure of tagged items in a struct. Only string fields are added, and only public fields. An example would be: type Example struct {

Stuff string `dict:"STUFF"`

} In this case the tag "ARCH_STUFF" would be added, with whatever value it's assigned.

func (*TemplateVarDictionary) Del

func (dict *TemplateVarDictionary) Del(key string)

func (*TemplateVarDictionary) DumpAsString

func (this *TemplateVarDictionary) DumpAsString() (output string)

func (*TemplateVarDictionary) Get

func (this *TemplateVarDictionary) Get(key string) (ret string, ok bool)

func (*TemplateVarDictionary) Render

func (this *TemplateVarDictionary) Render(input string) (output string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL