loreanvictor / tmplr

Automate Code Scaffolding
MIT License
27 stars 0 forks source link

Add `append` and `prepend` commands #20

Open loreanvictor opened 1 year ago

loreanvictor commented 1 year ago

These are useful for reusable recipes, as they might need to add to some files (for example, the README) without wholesale changing them. They should read some file, replace all variables in it, and append/prepend the content to some other file (without updating their variables).

prepend: header.md
to: README.md

Should it also support glob pattern? I am unsure, lets not do it for the first iteration at least.

loreanvictor commented 1 year ago

considering #4 , perhaps it is useful to have the input value be an expression instead of a file path:

prepend: "# Hallo!"
to: README.md

and have the combination of these two features handle appending / prepending files:

prepend:
  from file: header.md
to: README.md