- Notifications
You must be signed in to change notification settings - Fork1
swisscom/gte
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Inspired by the dockerize template library, GTE is a go template engine based on the golang template package and the go-jmespath library (JMESPath is a query language for JSON).
gte [options] template destination [template destination]...
-n --no-overwrite Do not overwrite destination file if it already exists.-d --delims template tag delimiters. default "{{":"}}"
Arguments:
template - the template. Can be passed multiple times together with destination as an ordered pair (2-tuple). Does also support directories.
destination - the destination . Can be passed multiple times together with destination as an ordered pair (2-tuple). Does also support directories.
Generate test.conf using test.tmpl as a template.
gte test.tmpl /etc/test/test.conf
content template test.tmpl:
#Begin Configjson:{{ jsonQuery `{"cc":{"servers":[{"host":"aa","port":1001},{"host":"bb","port":1002},{"host":"cc","port":1003}]}}` `-i2 cc.servers[*]` }}#End Config
generated test.conf:
#Begin Configjson:[ { "host": "aa", "port": 1001 }, { "host": "bb", "port": 1002 }, { "host": "cc", "port": 1003 }] #End Config
{{ jsonQuery \`json-source\` \`[options] jmespath\` }}
e.g. `{"host": "10.0.0.1"}`
e.g. .Env.VCAP_SERVICES (json in environment variable)
jmespath: valid jmespath (seehttp://jmespath.org)
e.g. `host`
e.g. `services[0].host`
e.g. `services[?host=='10.0.0.1']`
(none)output rendered as inline json
-iNUMintend json output with the defined number of spaces, e.g. -i5
-yyaml output
About
Inspired by the dockerize template library, GTE is a go template engine based on the golang template package and the go-jmespath library (JMESPath is a query language for JSON).
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.