jinja2-cli
jinja2-cli copied to clipboard
Feature request: add support for jinja2 Environment options
Hi, it would be absolutely amazing to add the following options:
--trim_blocks
--lstrip_blocks
They would translate 1:1 to jinja2.Environment options.
Thanks!
I'm thinking maybe something a bit more generic for setting any of these:
https://github.com/mattrobenolt/jinja2-cli/blob/main/jinja2cli/cli.py#L264-L268
There's quite a lot of options here: https://jinja.palletsprojects.com/en/3.0.x/api/#jinja2.Environment
And I think if we're going to get into configuring them, it might make sense to just allow you to set any of them more as key=value pairs.
So something like:
--env trim_blocks=True --env block_start_string={{
Or something and this can cover all bases.
Thoughts?
Thoughts?
Hi. I would go with --trim_blocks --lstrip_blocks --block_start_string={{ options because it is simple and readable and easy and understandable and maintainable.
For --env trim_blocks=True --env block_start_string={{ you would have to write a custom conversion function that properly handles types - str, bool, int - depending on the option. This is work and is a maintenance burden, and the options will have to be enumerated anyway to get the type, and user error messages might be confusing --env invalidoption