tem
Tem is a templating tool that uses YAML/ JSON as parameter input.
Hello example (examples/hello
)
values.yaml
# The name of the user
name: "Tem User"
# The website that the user should visit
website: "https://github.com/amurant/tem"
Generate templated file
hello.template.txt
Hello {{ .values.name }},
Checkout this website: {{ .values.website }}
> tem -f values=./values.yaml -t hello.template.txt
Hello Tem User,
Checkout this website: https://github.com/amurant/tem
Generate docs for file
docs.template.md
| path | description | value |
| ---- | ----------- | ----- |
{{- $valueComments := comments "values" }}
{{- range $index, $comment := $valueComments }}
| {{ join "." $comment.Path }} | {{ $comment.Comment }} | {{ $comment.Value }} |
{{- end }}
> tem -f values=./values.yaml -t docs.template.md
| path | description | value |
| ---- | ----------- | ----- |
| name | The name of the user | "Tem User" |
| website | The website that the user should visit | "https://github.com/amurant/tem" |
Installation
curl -Lo tem https://github.com/amurant/tem/releases/latest/download/tem
chmod +x tem
sudo mv tem /usr/bin/
Template functions
- the sprig functions (src)
- Helm's serdes functions (src):
toToml
toYaml
fromYaml
fromYamlArray
toJson
fromJson
fromJsonArray
comments
function (src) that returns the comments in the yaml file