hcl/ext/userfunc/README.md
Martin Atkins 708abb8c97 Move the zcl package and its two parsing subpackages to "hcl" names
This is a super-invasive update since the "zcl" package in particular
is referenced all over.

There are probably still a few zcl references hanging around in comments,
etc but this takes care of most of it.
2017-09-11 16:40:37 -07:00

23 lines
770 B
Markdown

# zcl User Functions Extension
This zcl extension allows a calling application to support user-defined
functions.
Functions are defined via a specific block type, like this:
```zcl
function "add" {
params = ["a", "b"]
result = a + b
}
```
The extension is implemented as a pre-processor for `cty.Body` objects. Given
a body that may contain functions, the `DecodeUserFunctions` function searches
for blocks that define functions and returns a functions map suitable for
inclusion in a `hcl.EvalContext`. It also returns a new `cty.Body` that
contains the remainder of the content from the given body, allowing for
further processing of remaining content.
For more information, see [the godoc reference](http://godoc.org/github.com/zclconf/go-zcl/ext/userfunc).