Skip to content

Commit

Permalink
allow prompt includes
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianliechti committed Dec 20, 2024
1 parent 15b0f17 commit 5a4b1c6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/template/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func NewTemplate(text string) (*Template, error) {
"now": now,
"date": date,
"dateInZone": dateInZone,
"include": include,
}).
Parse(text)

Expand Down
15 changes: 15 additions & 0 deletions pkg/template/template_include.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package template

import (
"os"
)

func include(path string) string {
data, err := os.ReadFile(path)

if err != nil {
panic(err)
}

return string(data)
}

0 comments on commit 5a4b1c6

Please sign in to comment.