Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 5 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 (9 months ago)
- Default Branch: main
- Last Pushed: 2024-05-13T12:24:12.000Z (6 months ago)
- Last Synced: 2024-10-04T13:40:30.427Z (about 1 month ago)
- Topics: config, configuration, golang, helm, json, template, yaml
- Language: Go
- Homepage:
- Size: 30.3 KB
- Stars: 22
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Templater
![License](https://img.shields.io/badge/license-MIT-green.svg) ![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg) ![Version](https://img.shields.io/badge/version-3.0.0-blue.svg)
**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
```### 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
```