Implement readDirEntries method

Signed-off-by: vasicvuk <vuk.vasic@asseco-see.rs>
This commit is contained in:
vasicvuk
2022-07-26 16:20:38 +02:00
parent d27765148e
commit 68d7c5f6a4
8 changed files with 194 additions and 71 deletions
+7
View File
@@ -1,9 +1,12 @@
package tmpl
import "io/fs"
type Context struct {
preRender bool
basePath string
readFile func(string) ([]byte, error)
readDir func(string) ([]fs.DirEntry, error)
}
// SetBasePath sets the base path for the template
@@ -14,3 +17,7 @@ func (c *Context) SetBasePath(path string) {
func (c *Context) SetReadFile(f func(string) ([]byte, error)) {
c.readFile = f
}
func (c *Context) SetReadDir(f func(string) ([]fs.DirEntry, error)) {
c.readDir = f
}