Skip to content

shiwano/musta

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

musta Build Status

A command-line tool for Mustache template, written in Go.

Installation

Via binary releases.

Via go-get:

$ go get github.com/shiwano/musta

Via Homebrew:

brew tap shiwano/formulas
brew install musta

Usage

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

Parsing Array

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 }
  ]
}

License

Copyright (c) 2015 Shogo Iwano Licensed under the MIT license.

About

A command-line tool for Mustache template, written in Go.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages