Open jnsnow opened 5 years ago
Nice idea. A very simple solution is to turn the template into a hook script that outputs a template. Then the script can do anything to generate a dynamic template.
So this would work like a "git sendemail-validate hook", allowing changes in the message, but only for the cover letter?
we could, for example, validate metadata in the message? I know some folks that are really interested in such a feature =)
Something like: define a "process-cover-letter-script = some-script.py" in .gitpublish
then invoke 'some-script.py' if it's defined, before sending the email. The script could be customized to do whatever it wants, like replace {diffstat} by the contents (git-backport-diff -r '@{u}..' -u my-topic-v{N-1}), or even check if the information in the cover letter contains everything that a certain bot expects?
Yes, sounds good!
It might be nice to allow for a meta-language in blurbs that facilitate a primitive post-processing.
For example,
Could be something like this:
Where {diffstat} invokes a hook to perform some known action (like git-backport-diff -r '@{u}..' -u my-topic-v{N-1}) and replaces that section with the output from the hook.
When editing the blurb, you'd leave {diffstat} in to allow it to be populated when sending, but not saved for future versions.
In the past, I've also scripted appending things like "And here's where this git branch is mirrored on github, for convenience" that could also take the form of another templating hook.