https://github.com/benstigsen/shgen
tiny posix shell templating engine
https://github.com/benstigsen/shgen
Last synced: 6 months ago
JSON representation
tiny posix shell templating engine
- Host: GitHub
- URL: https://github.com/benstigsen/shgen
- Owner: benstigsen
- Created: 2024-11-03T01:02:06.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-23T00:13:09.000Z (about 1 year ago)
- Last Synced: 2025-06-04T06:58:12.753Z (7 months ago)
- Language: Shell
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# shgen
tiny posix shell templating engine.
## example
**foo.shtml**
```html
$(cat './partials/header.html')
$([ 5 -lt 3 ] && echo 'true' || echo 'false')
- $index is $item
$(loop "$(ls)" '
```
**./partials/header.html**
```html
shgen
```
run it like this: `shgen foo.shtml`
**output**
```html
shgen
false
- 0 is foo.shtml
- 1 is header.html
```
## usage
```sh
usage: shgen [FILE]
options:
-h, --help show this help message
examples:
shgen template.txt # process a file
cat file.txt | shgen # process from stdin
```
_**note:** only lines containing `$` will be evaluated.
use 'single quotes' for strings outside of $(command substitutions) or escape backticks and double quotes with backslash._