jinja2-cli
jinja2-cli copied to clipboard
Add the ability to import filters
Fixes #85
I like this one a lot. Why is is not merged?
I think it was just waiting on some outside confirmation. Wanna try it out? :)
I think it was just waiting on some outside confirmation. Wanna try it out? :)
I've been testing out this update, and it works as expected. I successfully tested both single and multiple filters (e.g. jinja2 -f myfilter.myfunction -f ansible.plugins.filter.core.combine test.txt).
I hope you will merge this, since I really need this feature :) I looked through the code, and its very simple and elegant, and its hard for me to see how anything could go wrong. Sincerely.
Is there any chance to see this PR merged into main branch? It can drastically extend jina2-cli capabilities.
I tested this patch and it works fine. For example, we have hostname and want to add ip address in rendered config file, so it can be one simple filter (filters/ip.py):
import socket
def get_ip(hostname):
return socket.gethostbyname(hostname)
and in template it can be
{{ hostname }}: {{ hostname | get_ip }}
jinja2 -f filters.ip.get_ip test.j2 test.yaml
@mattrobenolt any chances to merge this change?