https://github.com/tkuchiki/envlate
Expand environment variables in template (the templates use Go text/template syntax)
https://github.com/tkuchiki/envlate
cli env environment-variables golang template
Last synced: 2 months ago
JSON representation
Expand environment variables in template (the templates use Go text/template syntax)
- Host: GitHub
- URL: https://github.com/tkuchiki/envlate
- Owner: tkuchiki
- License: mit
- Created: 2017-02-11T11:01:22.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-15T06:32:13.000Z (over 8 years ago)
- Last Synced: 2025-01-25T09:11:11.362Z (4 months ago)
- Topics: cli, env, environment-variables, golang, template
- Language: Go
- Size: 6.84 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# envlate
Expand environment variables in template (the templates use Go text/template syntax)## Installation
Download from https://github.com/tkuchiki/envlate/releases
## Usage
```shell
$ ./envlate --help
usage: envlate []Expand environment variables in template (the templates use Go text/template syntax)
Flags:
--help Show context-sensitive help (also try --help-long and --help-man).
-f, --file=FILE Template file
-u, --unset-error Treat unset variables as an error
-o, --output=FILENAME Write the output to the file rather than to stdout
--mode="0644" File permission
--version Show application version.
```## Examples
```shell
$ cat test.tpl
- {{.foo}}
- {{.bar}}$ ./envlate -f examples/test.tpl
-
-$ foo=baz bar=qux ./envlate -f examples/test.tpl
- baz
- qux$ echo "{{.foo}}" | foo=bar ./envlate
bar$ echo '{{or .foo "baz"}}' | ./envlate
baz$ ./envlate -f examples/test.tpl -u
2017/02/11 21:52:35 line 1 char 4 : no entry for key `foo`$ echo "{{.foo}}" | foo=bar ./envlate -o test.txt
$ cat test.txt
bar$ foo="foo,bar,baz" ./envlate -f examples/split.tpl
- foo
- bar
- baz
```