musta

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2015 License: MIT Imports: 9 Imported by: 0

README

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.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL