-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Created command line tool #425
Conversation
I'd follow the ruby mustache argument order: (see mustache(1)) |
Also, we should allow users to specify cat data.json | mustache - myTemplate.mustache > out.html |
Awesome! With @bobthecow's changes, I'd give 👍. Can't wait to have this, since I recently started toying with using |
While we're at it, how 'bout allowing an arbitrary number of datas? |
@bobthecow, what would be the purpose of input? What's the expected output? |
@dasilvacontin |
I see, interesting! Thumbs up incoming after the commits. :) |
Great feedback guys, thanks! I'll do some changes within the next couple of days :) |
eb92f0e
to
028fe76
Compare
CLI used to render a mustache template with a data view, writes the template into stdout when successfull. Otherwise meaningfull errors into stderr. Fixes janl#424
028fe76
to
65387a5
Compare
Has changed argument ordering and added support for stdin. |
@bobthecow multiple data views are interesting! Have you thought of scenarios where multiple data views would enable something one data view with an array as root could not? E.g two views of: {
"message": "LeBron"
} {
"message": "r0x!"
} compared to one view with: [
{
"message": "LeBron"
},
{
"message": "r0x!"
}
] |
I was thinking of a use case of a directory full of data files, and not having to preprocess them into a JSON array before using them. But I suppose you'd usually want to do more than newline delimited, so you're back to preprocessing. |
Played with that thought for a couple of minutes. Looks like it would be possible to push multiple single JSON objects into stdin reading them with the awesome JSONStream module. $ cat messages/*.json | mustache - message.mustache > messages.html Knowing its possible is good and all, but it doesnt really sound like you need it atm? If not lets do a PR on it later if/when someone actually needs it, I would happily contribute. |
Don't hold anything up for my hypothetical feature. :) |
jsonstream is pretty cool. i've played with it a bit as well :) |
Cool! |
👍 |
Hey,
my first shot at a CLI used to render a mustache template with a data view and writes the template into stdout when successfull. Otherwise meaningfull errors into stderr.
The short story is it enables
$ mustache myTemplate.mustache dataView.json > output.html
Changes in the readme.md + tests pretty much sums it up.
Any thoughts?