https://github.com/relaxdiego/renderest
Way better than your average renderer.
https://github.com/relaxdiego/renderest
bash tdd templating
Last synced: 8 months ago
JSON representation
Way better than your average renderer.
- Host: GitHub
- URL: https://github.com/relaxdiego/renderest
- Owner: relaxdiego
- Created: 2017-05-13T05:23:34.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2020-08-24T04:38:29.000Z (almost 6 years ago)
- Last Synced: 2025-03-15T04:44:11.072Z (over 1 year ago)
- Topics: bash, tdd, templating
- Language: Shell
- Homepage: https://relaxdiego.com
- Size: 33.2 KB
- Stars: 18
- Watchers: 4
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-tools - renderest - Way better than your average renderer. (General Purpose Preprocessor / Snippets Manager)
README
This repo is the companion source code for my article on
[Templating and Testing with BASH](https://relaxdiego.com/2017/05/templating-and-testing-with-bash.html).
## Usage
Given template.txt:
```bash
Hello, {{person}}!
```
Run:
```
$ person=Bob ./render template.txt
```
And you'll see the output
```
Hello, Bob!
```
Write it to a file by redirecting stdout to a file:
```
$ person=Bob ./render template.txt > rendered.txt
```
Or declare your variables in a file and then source it. Best done inside a script:
```bash
#!/usr/bin/env bash
source ./myvalues
./render template.txt > rendered.txt
```
Error out on empty env variables:
```
$ person= ./render --no-empty template.txt > rendered.txt
```
## Testing
Just run:
```
./test-render
```