diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2024-05-12 13:54:28 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-12 13:54:28 -0400 |
| commit | edaf202f95bd52c35ba54c54452e8940002cf897 (patch) | |
| tree | d605df822eec1011f99afbc22e02ba640b7a06d2 /docs/content | |
| parent | 607d4a66e3e9c525f0dfbbc71a9f9bc3f9bdbb38 (diff) | |
ci(docs): Require up-to-date function docs (#2071)
* ci(docs): Require up-to-date function docs
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
* docs(fix): update regenerated docs
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
---------
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'docs/content')
| -rw-r--r-- | docs/content/functions/data.md | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/docs/content/functions/data.md b/docs/content/functions/data.md index 9fd278f4..1c382157 100644 --- a/docs/content/functions/data.md +++ b/docs/content/functions/data.md @@ -536,6 +536,43 @@ Go COBOL ``` +## `data.CUE`_(unreleased)_ +**Unreleased:** _This function is in development, and not yet available in released builds of gomplate._ + +**Alias:** `cue` + +Converts a [CUE](https://cuelang.org/) document into an object. Any type +of CUE document is supported. This can be used to access properties of CUE +documents. + +Note that the `import` statement is not yet supported, and will result in +an error (except for importing builtin packages). + +### Usage + +``` +data.CUE input +``` +``` +input | data.CUE +``` + +### Arguments + +| name | description | +|------|-------------| +| `input` | _(required)_ the CUE document to parse | + +### Examples + +```console +$ gomplate -i '{{ $t := `data: { + hello: "world" + }` -}} + Hello {{ (cue $t).data.hello }}' +Hello world +``` + ## `data.ToJSON` **Alias:** `toJSON` @@ -726,3 +763,46 @@ first,second 1,2 3,4 ``` + +## `data.ToCUE`_(unreleased)_ +**Unreleased:** _This function is in development, and not yet available in released builds of gomplate._ + +**Alias:** `toCUE` + +Converts an object to a [CUE](https://cuelang.org/) document in canonical +format. The input object can be of any type. + +This is roughly equivalent to using the `cue export --out=cue <file>` +command to convert from other formats to CUE. + +### Usage + +``` +data.ToCUE input +``` +``` +input | data.ToCUE +``` + +### Arguments + +| name | description | +|------|-------------| +| `input` | _(required)_ the object to marshal as a CUE document | + +### Examples + +```console +$ gomplate -i '{{ `{"foo":"bar"}` | data.JSON | data.ToCUE }}' +{ + foo: "bar" +} +``` +```console +$ gomplate -i '{{ toCUE "hello world" }}' +"hello world" +``` +```console +$ gomplate -i '{{ coll.Slice 1 "two" true | data.ToCUE }}' +[1, "two", true] +``` |
