tem

module
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2021 License: MIT

README

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

Directories

Path Synopsis
cmd
tem
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL