wrouesnel / p2cli

pongo2 cli - like the j2cli package in python, but compiles to self-contained go executables
GNU General Public License v2.0
87 stars 19 forks source link

Select specific files for rendering when directory mode is enabled #44

Open tobiade opened 1 year ago

tobiade commented 1 year ago

Hello, I have a feature request and wondering if it's worth implementing or not. Essentially, I have a folder containing a bunch of configuration files and templates e.g. CloudWatch configs, Dockerfiles etc. Like so:

configuration
├── cloudwatch
│   └── cloudwatch_config.p2.json
└── docker
    └── Dockerfile

I'm using p2's --directory-mode to render templates, and the templates have a .p2 suffix which is removed by using the --directory-mode-filename-substr-del flag.

In the (highly) unlikely event that one of my non-template configuration files (e.g. Dockerfile in the example above) has p2-recognisable syntax, then p2 will attempt to render that file as a template. I was wondering if it's worth adding a filter to only render files that have the .p2 suffix.

tobiade commented 1 year ago

Hey @wrouesnel thoughts on this? I can raise a PR.