A command-line tool for Mustache template, written in Go.
Via binary releases.
Via go-get
:
$ go get github.com/shiwano/musta
Via Homebrew:
brew tap shiwano/formulas
brew install musta
With a template file.
$ cat template.mustache
foo: {{foo}}
$ musta -t template.mustache foo=bar
foo: bar
With a template string.
$ musta -T "foobar: {{foo.bar}}, qux: {{#qux}}{{value}}{{^last}},{{/last}}{{/qux}}" foo.bar=1 qux=1,2,3
foobar: 1, qux: 1,2,3
With piped JSON data.
$ cat tokyo-weather.json | musta -t weather.mustache >> tokyo-weather.html
musta will parse a comma-separated string as an array.
For example, values=a,b,c
will be parsed like the following JSON data.
{
"values": [
{ "index": 0, "value": "a", "first": true, "last": false },
{ "index": 1, "value": "b", "first": false, "last": false },
{ "index": 2, "value": "c", "first": false, "last": true }
]
}
Copyright (c) 2015 Shogo Iwano Licensed under the MIT license.