{"repo":"kpfleming/jinjanator","free":true,"listed":false,"github":"https://github.com/kpfleming/jinjanator","clone":"git clone https://github.com/kpfleming/jinjanator.git","description":"Jinja2 Command-Line Tool, reworked, again","language":"Python","stars":136,"topics":["cli","jinja2","jinja2-cli","python","python3"],"license":"BSD-2-Clause","category":"cli-tools","readme_excerpt":"jinjanator This repo contains jinjanator , a CLI tool to render Jinja2 templates. It is a fork of j2cli , which itself was a fork of jinja2-cli , both of which are no longer actively maintained. Open Source software: Apache License 2.0 &nbsp; Features: Jinja2 templating INI, YAML, JSON data sources supported Environment variables can be used with or without data files Plugins can provide additional formats, filters, tests, extensions and global functions (see jinjanator-plugins for details) Installation Available Plugins jinjanator-plugin-ansible - makes Ansible's 'core' filters and tests available during template rendering jinjanator-plugin-format-toml - provides a TOML parser for input data files jinjanator-plugin-format-xml - provides an XML parser for input data files Tutorial Suppose you have an NGINX configuration file template, nginx.j2 : And you have a JSON file with the data, nginx.json : This is how you render it into a working configuration file: The output is saved to nginx.conf : Alternatively, you can use the -o nginx.conf or --output-file nginx.conf options to write directly to the file. Tutorial with environment variables Suppose, you have a very simple template, person.xml.j2 : What is the easiest way to use jinjanator here? Use environment variables in your Bash script: Using environment variables Even when you use a data file as the data source, you can always access environment variables using the env() function: Or, if you prefer, as a filter: CLI Referen","default_branch":null,"files":null,"tree":[],"storefront":"/r/kpfleming","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/kpfleming/jinjanator/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}