template

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Copyright © 2024 Daniele Rondina <geaaru@macaronios.org> See AUTHORS and LICENSE for the license details and contributors.

Based on the lxd-compose code

Copyright © 2024 Daniele Rondina <geaaru@macaronios.org> See AUTHORS and LICENSE for the license details and contributors.

Based on the lxd-compose code

Copyright © 2024 Daniele Rondina <geaaru@macaronios.org> See AUTHORS and LICENSE for the license details and contributors.

Based on the lxd-compose code

Copyright © 2024 Daniele Rondina <geaaru@macaronios.org> See AUTHORS and LICENSE for the license details and contributors.

Based on the lxd-compose code

Copyright © 2024 Daniele Rondina <geaaru@macaronios.org> See AUTHORS and LICENSE for the license details and contributors.

Based on the lxd-compose code

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompileAllProjectFiles

func CompileAllProjectFiles(env *specs.SshCEnvironment, pName string, opts CompilerOpts) error

func CompileGroupFiles

func CompileGroupFiles(group *specs.SshCGroup, compiler SshCTemplateCompiler, opts CompilerOpts) error

func CompileNodeFiles

func CompileNodeFiles(node specs.SshCNode, compiler SshCTemplateCompiler, opts CompilerOpts) error

func CompileProjectFiles

func CompileProjectFiles(proj *specs.SshCProject, compiler SshCTemplateCompiler, opts CompilerOpts) error

Types

type CompilerOpts

type CompilerOpts struct {
	Sources        []string
	GroupsEnabled  []string
	GroupsDisabled []string
}

func (*CompilerOpts) IsGroupEnabled

func (o *CompilerOpts) IsGroupEnabled(g string) bool

type DefaultCompiler

type DefaultCompiler struct {
	Project    *specs.SshCProject
	Opts       []string
	Vars       map[string]interface{}
	EnvBaseDir string
}

func (*DefaultCompiler) GetEnvBaseDir

func (r *DefaultCompiler) GetEnvBaseDir() string

func (*DefaultCompiler) GetVars

func (r *DefaultCompiler) GetVars() *map[string]interface{}

func (*DefaultCompiler) InitVars

func (r *DefaultCompiler) InitVars()

func (*DefaultCompiler) SetEnvBaseDir

func (r *DefaultCompiler) SetEnvBaseDir(dir string)

func (*DefaultCompiler) SetOpts

func (r *DefaultCompiler) SetOpts(o []string)

type Jinja2Compiler

type Jinja2Compiler struct {
	*DefaultCompiler
}

func NewJinja2Compiler

func NewJinja2Compiler(proj *specs.SshCProject) *Jinja2Compiler

func (*Jinja2Compiler) Compile

func (r *Jinja2Compiler) Compile(sourceFile, destFile string) error

func (*Jinja2Compiler) CompileRaw

func (r *Jinja2Compiler) CompileRaw(sourceData string) (string, error)

type MottainaiCompiler

type MottainaiCompiler struct {
	*DefaultCompiler
}

func NewMottainaiCompiler

func NewMottainaiCompiler(proj *specs.SshCProject) *MottainaiCompiler

func (*MottainaiCompiler) Compile

func (r *MottainaiCompiler) Compile(sourceFile, destFile string) error

func (*MottainaiCompiler) CompileRaw

func (r *MottainaiCompiler) CompileRaw(sourceData string) (string, error)

type SshCTemplateCompiler

type SshCTemplateCompiler interface {
	InitVars()
	SetOpts([]string)
	Compile(sourceFile, destFile string) error
	CompileRaw(sourceContent string) (string, error)
	GetEnvBaseDir() string
	SetEnvBaseDir(string)
	GetVars() *map[string]interface{}
}

func NewProjectTemplateCompiler

func NewProjectTemplateCompiler(env *specs.SshCEnvironment, proj *specs.SshCProject) (SshCTemplateCompiler, error)

type Template

type Template struct {
	Values map[string]interface{}
}

func NewTemplate

func NewTemplate() *Template

func (*Template) AppendValue

func (tem *Template) AppendValue(k string, v interface{})

func (*Template) Draw

func (tem *Template) Draw(raw string) (string, error)

func (*Template) DrawFromFile

func (tem *Template) DrawFromFile(file string) (string, error)

func (*Template) LoadValues

func (tem *Template) LoadValues(raw string) error

func (*Template) LoadValuesFromFile

func (tem *Template) LoadValuesFromFile(file string) error

func (*Template) ReadValues

func (tem *Template) ReadValues(raw string) (map[string]map[string]interface{}, error)

Jump to

Keyboard shortcuts

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