Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
OutDir string
CodeletDir string
Values map[string]any
// contains filtered or unexported fields
}
func NewApp ¶
NewApp creates a new App instance outDir: directory for output codeletDir: directory for codelet valuesFile: file path of external values file. if empty, it will be ignored.
func (*App) LoadValues ¶
LoadValues returns the values data from codelet's default values.yaml file and given values file.
func (*App) Render ¶
Render renders the templates. internally, it just runs `render.star` file in the CodeletDir
func (*App) RenderFile ¶
RenderFile renders a file with the given template and data filePath: the file path to render. The path is relative to the output directory. templatePath: the template path. The path is relative to the ${codeletdir}/templates directory. data: the data to render returns the destination file path.
type EeaaoStarlarkModule ¶ added in v0.2.4
type EeaaoStarlarkModule struct {
*starlarkstruct.Module
// contains filtered or unexported fields
}
EeaaoStarlarkModule is a starlark module that exposes the App's functions to starlark.
func NewEeaaoStarlarkModule ¶ added in v0.2.4
func NewEeaaoStarlarkModule(app *App) (m *EeaaoStarlarkModule)
type Template ¶ added in v0.2.4
func NewTemplate ¶ added in v0.2.4
NewTemplate creates a new Template instance. It initializes the template with the given directory and additional functions. The additional functions are
- sprig.FuncMap
- funcMap given as an argument.
- include: Template.Include method
tmplDir: directory for templates funcMap: additional functions to be added to the template.
func (*Template) AddTemplateFunc ¶ added in v0.2.4
AddTemplateFunc adds a function to the template.
func (*Template) ExecuteTemplate ¶ added in v0.2.4
ExecuteTemplate executes the template specified by the tmplPath, which is relative to the template directory. If the template is not found in the template directory, it reads the template file from the template directory and parses it.
func (*Template) Include ¶ added in v0.2.4
Include renders a template with the given data.
Drop-in replacement for template pipeline, but with a string return value so that it can be treated as a string in the template.
Inspired by [helm include function](https://helm.sh/docs/chart_template_guide/named_templates/#the-include-function)