Is there a standalone, portable command line implementation of Mustache for windows?

mustache

Solution

(Full disclosure: I am the maintainer of this project.)

I have written mo, which is a Bash port of the mustache templating system. Its major caveat is that it uses environment variables instead of reading from a `.json` file.

$ export name="John Doe"
$ cat template.mo
Hello {{name}}.
{{^name2}}The variable name2 is not defined.{{/name2}}
$ mo template.mo
Hello John Doe.
The variable name2 is not defined.

It also works with arrays, but Bash can not export arrays to other functions. So, to have arrays work you will need to either source another file or source `mo` itself into the environment and then call the `mo` function.

The repository contains tests and examples to help illustrate how to use this tool.

Problem

Is there a simple, standalone, portable, existing distribution of Mustache for windows that lets me invoke Mustache exactly as specified (or as close as possible) in the mustache(1) manual? ``` cat data.yml template.mustache | mustache ``` I can't find any explanation of how to actually acquire an executable called `mustache` to use mustache in this way - on any platform, although I'm primarily interested in Windows right now. As far as I can tell, the various implementations of mustache listed on the mustache homepage are mostly libraries, rather than standalone applications that can be invoked in this way. Ideally, I'm looking for something that's: - Standalone - I am looking for something I can invoke from the command line, not a library. I am planning to generate output as part of my automated CI build. - Portable - I should be able to bundle everything I need into source control, without having to preinstall anything (since my build may run on one of many build agents, I do not wish to maintain a suite of preinstalled software on multiple agents); nor can I connect to the internet to download libraries. Ideally the portable packaging should be fairly straightforward to bundle. If this isn't available then I'm interested in getting as close as possible - e.g. if I have to preinstall python but not needing to run an installer which connects to the internet. I'm prepared to concede on the "no preinstall" if it's something I have a cat in hell's chance of already having packaged up at our organisation (e.g. python or ruby) but not for individual libraries.

Original source