package hclparser

import "github.com/docker/buildx/bake/hclparser"

Index

Functions

func EmptyBody

func EmptyBody() hcl.Body

EmptyBody returns a body with no content. This body can be used as a placeholder when a body is required but no body content is available.

func FilterExcludeBody

func FilterExcludeBody(body hcl.Body, schema *hcl.BodySchema) hcl.Body

func FilterIncludeBody

func FilterIncludeBody(body hcl.Body, schema *hcl.BodySchema) hcl.Body

func MergeBodies

func MergeBodies(bodies []hcl.Body) hcl.Body

MergeBodies is like MergeFiles except it deals directly with bodies, rather than with entire files.

func MergeFiles

func MergeFiles(files []*hcl.File) hcl.Body

MergeFiles combines the given files to produce a single body that contains configuration from all of the given files.

The ordering of the given files decides the order in which contained elements will be returned. If any top-level attributes are defined with the same name across multiple files, a diagnostic will be produced from the Content and PartialContent methods describing this error in a user-friendly way.

func Parse

func Parse(b hcl.Body, opt Opt, val interface{}) (map[string]map[string][]string, hcl.Diagnostics)

func Stdlib

func Stdlib() map[string]function.Function

Types

type Opt

type Opt struct {
	LookupVar     func(string) (string, bool)
	Vars          map[string]string
	ValidateLabel func(string) error
}

type WithEvalContexts

type WithEvalContexts interface {
	GetEvalContexts(base *hcl.EvalContext, block *hcl.Block, loadDeps func(hcl.Expression) hcl.Diagnostics) ([]*hcl.EvalContext, error)
}

type WithGetName

type WithGetName interface {
	GetName(ectx *hcl.EvalContext, block *hcl.Block, loadDeps func(hcl.Expression) hcl.Diagnostics) (string, error)
}

Source Files

body.go expr.go hclparser.go merged.go stdlib.go

Version
v0.15.1
Published
Jun 18, 2024
Platform
js/wasm
Imports
25 packages
Last checked
13 hours ago

Tools for package owners.