summaryrefslogtreecommitdiff
path: root/docs-src/content
diff options
context:
space:
mode:
authorDave Henderson <dhenderson@gmail.com>2018-09-08 08:45:48 -0400
committerDave Henderson <dhenderson@gmail.com>2018-09-08 09:08:07 -0400
commit2e972e568ff52d3c4606ce2b6350c0e764f44e03 (patch)
treeb3ce11a3379e8eb940498a053c577d99c5500281 /docs-src/content
parent2feda27f6a4aacdca921d78c2c327d923f74c618 (diff)
Adding dict/conv.Dict function
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'docs-src/content')
-rw-r--r--docs-src/content/functions/conv.yml36
1 files changed, 36 insertions, 0 deletions
diff --git a/docs-src/content/functions/conv.yml b/docs-src/content/functions/conv.yml
index 4f57f311..96d0e95b 100644
--- a/docs-src/content/functions/conv.yml
+++ b/docs-src/content/functions/conv.yml
@@ -7,6 +7,42 @@ funcs:
alias: bool
- name: conv.Default
alias: default
+ - name: conv.Dict
+ alias: dict
+ description: |
+ Dict is a convenience function that creates a map with string keys.
+ Provide arguments as key/value pairs. If an odd number of arguments
+ is provided, the last is used as the key, and an empty string is
+ set as the value.
+
+ All keys are converted to strings.
+
+ This function is equivalent to [Sprig's `dict`](http://masterminds.github.io/sprig/dicts.html#dict)
+ function, as used in [Helm templates](https://docs.helm.sh/chart_template_guide#template-functions-and-pipelines).
+
+ For creating more complex maps or maps with non-`string` keys, see
+ [`data.JSON`](../data/#data-json) or [`data.YAML`](../data/#data-yaml).
+
+ For creating arrays, see [`conv.Slice`](#conv-slice).
+ arguments:
+ - name: in...
+ required: true
+ description: The key/value pairs
+ examples:
+ - |
+ $ gomplate -i '{{ conv.Dict "name" "Frank" "age" 42 | data.ToYAML }}'
+ age: 42
+ name: Frank
+ $ gomplate -i '{{ dict 1 2 3 | toJSON }}'
+ {"1":"2","3":""}
+ - |
+ $ cat <<EOF| gomplate
+ {{ define "T1" }}Hello {{ .thing }}!{{ end -}}
+ {{ template "T1" (dict "thing" "world")}}
+ {{ template "T1" (dict "thing" "everybody")}}
+ EOF
+ Hello world!
+ Hello everybody!
- name: conv.Slice
alias: slice
- name: conv.Has