https://github.com/rjshrjndrn/templater
CMD golang template cli using sprig library. Like helm. But only for local templating.
https://github.com/rjshrjndrn/templater
config configuration golang helm json template yaml
Last synced: 10 days ago
JSON representation
CMD golang template cli using sprig library. Like helm. But only for local templating.
- Host: GitHub
- URL: https://github.com/rjshrjndrn/templater
- Owner: rjshrjndrn
- License: mit
- Created: 2024-02-11T06:02:45.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-22T16:00:47.000Z (16 days ago)
- Last Synced: 2025-04-28T17:18:02.929Z (10 days ago)
- Topics: config, configuration, golang, helm, json, template, yaml
- Language: Go
- Homepage:
- Size: 29.3 KB
- Stars: 25
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Templater
  
**Templater** is a cli tool that helps you to quickly and easily create files from templates, using go template.
## How to use
1. Inline variables
```bash
# File using helm templating
cat <<'EOF'>file
---
{{- $name := "John" }}
class:
{{- range $i := until 11 }}
{{$i}}: {{$name}}
{{- end }}
EOFtemplater -i file
# This will be the output
File: out/file
---
class:
0: John
1: John
2: John
3: John
4: John
5: John
6: John
7: John
8: John
9: John
10: John```
2. Passing variables from external yaml, using helm style templating.
```bash
# Value file
cat <<'EOF'>values.yaml
school: Govt. Public School
EOF
# File using helm templating
cat <<'EOF'>file
---
{{- $name := "John" }}
class:
school: {{ .Values.school }}
{{- range $i := until 11 }}
{{$i}}: {{$name}}
{{- end }}
EOFtemplater -i file -f values.yaml -o out/
# This will be the output
File: out/file
---
class:
school: Govt. Public School
0: John
1: John
2: John
3: John
4: John
5: John
6: John
7: John
8: John
9: John
10: John
```3. Using stdin
```bash
# Value file
cat <<'EOF'>values.yaml
name: Rajesh
EOFecho "hi: {{.Values.name}}" | templater -f values.yaml -i -
output:
hi: Rajesh
```### Installation
1. HomeBrew
`brew install rjshrjndrn/tap/templater`
2. Binary
Download the latest binary from [Release Page.](https://github.com/rjshrjndrn/templater/releases)
3. Using go get
```bash
go get github.com/rjshrjndrn/templater
```