feat: allow override of template delims

When you want to use "source":"template" arguments inside your hook file but also parse the hook file itself as a template, it is necessary use different delimiters on the two template parsers to avoid having to pepper all the inner templates with constructs like {{"{{"}}.  Added an extra command line argument -template-delims that expects a comma-separated pair of delimiters like '[[,]]' that will be used when parsing the whole hooks file template.  Inner templates in an Argument always use the default double-brace style.
This commit is contained in:
Ian Roberts 2024-10-24 09:38:31 +01:00
parent 9892bc678b
commit bb8be5ed9a
3 changed files with 13 additions and 6 deletions

View file

@ -433,7 +433,7 @@ func TestHooksLoadFromFile(t *testing.T) {
for _, tt := range hooksLoadFromFileTests {
h := &Hooks{}
err := h.LoadFromFile(tt.path, tt.asTemplate)
err := h.LoadFromFile(tt.path, tt.asTemplate, "")
if (err == nil) != tt.ok {
t.Errorf(err.Error())
}
@ -450,7 +450,7 @@ func TestHooksTemplateLoadFromFile(t *testing.T) {
}
h := &Hooks{}
err := h.LoadFromFile(tt.path, tt.asTemplate)
err := h.LoadFromFile(tt.path, tt.asTemplate, "")
if (err == nil) != tt.ok {
t.Errorf(err.Error())
continue