jinja2-cli
jinja2-cli copied to clipboard
Specifying the search path for FileSystemLoader
I have this directory structure on current workdir:
.
└── service
├── base.yaml
├── external
│ └── base.yaml
└── internal
└── base.yaml
The ./service/internal/base.yaml has a {% extends "./service/base.yaml" %} which works correctly if I run the jinja2 module manually with:
from jinja2 import Environment, FileSystemLoader, select_autoescape
env = Environment(loader=FileSystemLoader('.'))
env.get_template('service/internal/base.yaml').render()
But running jinja2 CLI fails:
$ jinja2 service/external/base.yaml
...
jinja2.exceptions.TemplateNotFound: service/base.yaml
I think jinja2 tool needs to use the current workdir ($CWD) as the search directory (or have a --flag to signal a /path/to/templates).
Hmm, seems like it would be an easy fix. I can try to whip something up, but if in the meantime you wanted to submit a fix, I'd happily review and merge it.
I'm pretty bad at python so I'll defer to you :)
meh, that's not a right fix.