summaryrefslogtreecommitdiff
path: root/docs-src/content/functions
diff options
context:
space:
mode:
authorDave Henderson <dhenderson@gmail.com>2023-10-24 10:31:59 -0400
committerGitHub <noreply@github.com>2023-10-24 10:31:59 -0400
commitb669b8a8b58fd7d8fe175b7318cbb1444d839f99 (patch)
tree332769edad08e999a92c817256e485fbb91d5ea9 /docs-src/content/functions
parent52991c4a5c62c16f6cf7067c02fd610aab0ad9ee (diff)
Support for CUE (#1781)
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'docs-src/content/functions')
-rw-r--r--docs-src/content/functions/data.yml46
1 files changed, 46 insertions, 0 deletions
diff --git a/docs-src/content/functions/data.yml b/docs-src/content/functions/data.yml
index 9392790d..6753cafe 100644
--- a/docs-src/content/functions/data.yml
+++ b/docs-src/content/functions/data.yml
@@ -383,6 +383,27 @@ funcs:
Go
COBOL
```
+ - name: data.CUE
+ alias: cue
+ description: |
+ 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).
+ pipeline: true
+ arguments:
+ - name: input
+ required: true
+ description: the CUE document to parse
+ examples:
+ - |
+ $ gomplate -i '{{ $t := `data: {
+ hello: "world"
+ }` -}}
+ Hello {{ (cue $t).data.hello }}'
+ Hello world
- name: data.ToJSON
alias: toJSON
released: v2.0.0
@@ -511,3 +532,28 @@ funcs:
1,2
3,4
```
+ - name: data.ToCUE
+ alias: toCUE
+ description: |
+ 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.
+ pipeline: true
+ arguments:
+ - name: input
+ required: true
+ description: the object to marshal as a CUE document
+ examples:
+ - |
+ $ gomplate -i '{{ `{"foo":"bar"}` | data.JSON | data.ToCUE }}'
+ {
+ foo: "bar"
+ }
+ - |
+ $ gomplate -i '{{ toCUE "hello world" }}'
+ "hello world"
+ - |
+ $ gomplate -i '{{ coll.Slice 1 "two" true | data.ToCUE }}'
+ [1, "two", true]