loreanvictor / tmplr

Automate Code Scaffolding
MIT License
26 stars 0 forks source link

add `tmplr preview` #5

Closed loreanvictor closed 1 year ago

loreanvictor commented 1 year ago

templating recipes do irreversible stuff, for example removing the templating recipe file itself. this makes creating and testing templates a bit difficult. this short-coming could be solved with a preview command, where the contents of the current folder are copied into a temporary folder, where the templating recipe is executed.

e.g:

tmplr preview

could copy the contents of current folder into a .tmplr-preview folder, and run the templating recipe there.

I think it would be wise to reserve the test command for something similar but for automated testing a templating recipe.

tommy-mitchell commented 1 year ago

Maybe a tmplr preview --dry-run could just output the steps that would be taken to the terminal.

loreanvictor commented 1 year ago

This feature is added in 0.2.9. I didn't implement a --dry-run option, as the same could be achieved via running tmplr preview && tmplr clean.