diff options
| author | Martin Atkins <mart@degeneration.co.uk> | 2018-02-04 10:33:35 -0800 |
|---|---|---|
| committer | Martin Atkins <mart@degeneration.co.uk> | 2018-02-04 10:33:35 -0800 |
| commit | 6c3ae68a0e00743020f02aa21a76f3d37ca215c9 (patch) | |
| tree | def16b4d57c473ca6cc991e9975dfda54f3f1e44 /cmd/hcldec/spec_funcs.go | |
| parent | 1ba92ee170ac6300d0538850241a953118bc85ef (diff) | |
cmd/hcldec: make cty stdlib functions available to specs
In a few specific portions of the spec format it's convenient to have
access to some of the functions defined in the cty stdlib. Here we allow
them to be used when constructing the value for a "literal" spec and in
the result expression for a "transform" spec.
Diffstat (limited to 'cmd/hcldec/spec_funcs.go')
| -rw-r--r-- | cmd/hcldec/spec_funcs.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/cmd/hcldec/spec_funcs.go b/cmd/hcldec/spec_funcs.go new file mode 100644 index 0000000..99c8ea6 --- /dev/null +++ b/cmd/hcldec/spec_funcs.go @@ -0,0 +1,24 @@ +package main + +import ( + "github.com/zclconf/go-cty/cty/function" + "github.com/zclconf/go-cty/cty/function/stdlib" +) + +var specFuncs = map[string]function.Function{ + "abs": stdlib.AbsoluteFunc, + "coalesce": stdlib.CoalesceFunc, + "concat": stdlib.ConcatFunc, + "hasindex": stdlib.HasIndexFunc, + "int": stdlib.IntFunc, + "jsondecode": stdlib.JSONDecodeFunc, + "jsonencode": stdlib.JSONEncodeFunc, + "length": stdlib.LengthFunc, + "lower": stdlib.LowerFunc, + "max": stdlib.MaxFunc, + "min": stdlib.MinFunc, + "reverse": stdlib.ReverseFunc, + "strlen": stdlib.StrlenFunc, + "substr": stdlib.SubstrFunc, + "upper": stdlib.UpperFunc, +} |
