Documentation ¶
Overview ¶
Package templatedir provide two functions that allow to render a whole directory of go templates to itself or to another directory.
Index ¶
- func RenderTo(srcfs fs.FS, destfsys writefs.WriteFS, args interface{}) error
- type Args
- type FS
- func (fsys *FS) DoSomething(number int) (bool, error)
- func (fsys *FS) Glob(pattern string) ([]string, error)
- func (fsys *FS) MkDir(name string, perm fs.FileMode) error
- func (fsys *FS) Open(name string) (fs.File, error)
- func (fsys *FS) OpenFile(name string, flag int, perm fs.FileMode) (writefs.FileWriter, error)
- func (fsys *FS) ReadDir(name string) ([]fs.DirEntry, error)
- func (fsys *FS) ReadFile(name string) ([]byte, error)
- func (fsys *FS) Remove(name string) error
- func (fsys *FS) Stat(name string) (fs.FileInfo, error)
- func (fsys *FS) Sub(dir string) (fs.FS, error)
- type SyncErrors
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Args ¶
type Args map[string]interface{}
Args ...
func DefaultArgs ¶
DefaultArgs ...
Example ¶
This example show how to use templatedir.Func()
package main import ( "embed" "fmt" "io/fs" "github.com/parrogo/templatedir" ) //go:embed fixtures var fixtureRootFS embed.FS var fixtureFS, _ = fs.Sub(fixtureRootFS, "fixtures") // This example show how to use templatedir.Func() func main() { args, err := templatedir.DefaultArgs() if err != nil { panic(err) } fmt.Println(args["RepoName"]) fmt.Println(args["Author"]) }
Output: templatedir parrogo
type FS ¶ added in v1.0.2
FS mocks
func (*FS) DoSomething ¶ added in v1.0.2
DoSomething is a method on MyMockedObject that implements some interface and just records the activity, and returns what the Mock object tells it to.
In the real object, this method would do something useful, but since this is a mocked object - we're just going to stub it out.
NOTE: This method is not being tested here, code that uses this object is.
type SyncErrors ¶
type SyncErrors chan error
SyncErrors ...
func (SyncErrors) SetFailedOnErr ¶
func (errs SyncErrors) SetFailedOnErr(err error) bool
SetFailedOnErr ...
Click to show internal directories.
Click to hide internal directories.