MCPcopy
hub / github.com/hashicorp/hcl / parseVarsBody

Function parseVarsBody

cmd/hcldec/vars.go:45–58  ·  view source on GitHub ↗
(body hcl.Body)

Source from the content-addressed store, hash-verified

43}
44
45func parseVarsBody(body hcl.Body) (map[string]cty.Value, hcl.Diagnostics) {
46 attrs, diags := body.JustAttributes()
47 if attrs == nil {
48 return nil, diags
49 }
50
51 vals := make(map[string]cty.Value, len(attrs))
52 for name, attr := range attrs {
53 val, valDiags := attr.Expr.Value(nil)
54 diags = append(diags, valDiags...)
55 vals[name] = val
56 }
57 return vals, diags
58}
59
60// varSpecs is an implementation of pflag.Value that accumulates a list of
61// raw values, ignoring any quoting. This is similar to pflag.StringSlice

Callers 2

parseVarsArgFunction · 0.85
parseVarsFileFunction · 0.85

Calls 2

JustAttributesMethod · 0.65
ValueMethod · 0.65

Tested by

no test coverage detected