Skip to content

Commit

Permalink
docs: enhance documentation and update testing configurations
Browse files Browse the repository at this point in the history
- Improve the documentation for the `AddFromFS` function, providing detailed descriptions for parameters and return values.

Signed-off-by: appleboy <[email protected]>
  • Loading branch information
appleboy committed Dec 28, 2024
1 parent c70d254 commit 35ef918
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion dynamic.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,16 @@ func (r DynamicRender) AddFromGlob(name, glob string) *template.Template {
return builder.buildTemplate()
}

// AddFromFS supply add template from fs.FS (e.g. embed.FS)
// AddFromFS adds a new template to the DynamicRender from the provided file system (fs.FS) and files.
// It allows you to specify a custom function map (funcMap) to be used within the template.
// The name parameter is used to associate the template with a key in the DynamicRender.
// The files parameter is a variadic list of file paths to be included in the template.
// - name: The name to associate with the template in the DynamicRender.
// - fsys: The file system (fs.FS) from which to read the template files.
// - files: A variadic list of file paths to be included in the template.
//
// Returns:
// - *template.Template: The constructed template.
func (r DynamicRender) AddFromFS(name string, fsys fs.FS, files ...string) *template.Template {
builder := &templateBuilder{templateName: name, fsys: fsys, files: files}
builder.buildType = fsTemplateType
Expand Down

0 comments on commit 35ef918

Please sign in to comment.