The mako2cli Python Project¶
This project aim to port the Mako Template library to a simple command line usage. The command line could render a template file using a data source from a yaml file.
Installation¶
To install the mako2cli Python project, run this command in your terminal:
$ pip install mako2cli
Example¶
Create a file template.mako containing:
hello ${name}!
And a data file data.yaml:
name: world
Now you can render the file with:
$ m2cli -t template.mako -d data.yaml -o rendered
The output is saved to rendered:
hello world!
That’s all!
Usage¶
Mako2cli usage looks like:
$ m2cli [OPTIONS]
-
-t,--templatePATH template file (mako) [required]¶ Path to the file containing the template to render.
-
-d,--dataPATH file containing data (YAML) [required]¶ Path to the file containing the data to use for rendering.
-
-o,--outputPATH output file path [required]¶ File that will contain the rendered file.
-
--version¶ Display the version and exit.
-
--help¶ Display a short usage message and exit.