gobuffalo / plush

The powerful template system that Go needs
MIT License
900 stars 56 forks source link

Render Plush templates from Command Line #19

Open meson10 opened 7 years ago

meson10 commented 7 years ago

I have started using Plush in one of my project. Firstly, Good work :+1: As a part of the code pipeline, some of the Plush templates need to be validated for consistency and the output they will render.

Inspired from the erb command line tool, I have added support to plush binary to render a given template based on CLI vars or input JSON file.

Example Usage:

meson10@xps:~/workspace/plush$ cat hello.plush 
Hello, <%= name %>

meson10@xps:~/workspace/plush$ plush render hello.plush 
Hello, 

meson10@xps:~/workspace/plush$ cat test.json 
{"name": "world"}

meson10@xps:~/workspace/plush$ plush render hello.plush -c test.json 
Hello, world

meson10@xps:~/workspace/plush$ plush render hello.plush -v name=Mark
Hello, Mark

If this is of merit to your code I can send a PR. Alternatively, Please suggest if there is a better way to achieve the desired functionality.

markbates commented 7 years ago

That sounds great! I would love to see the plush binary get that.

meson10 commented 7 years ago

@markbates Ok cool. Sending PR.

meson10 commented 7 years ago

@markbates https://github.com/gobuffalo/plush/pull/20