diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-02-28 08:52:15 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-02-28 08:59:57 +0100 |
commit | 12d00d288cec5018949be06010df7c11d8ff06f0 (patch) | |
tree | fba0437e3f411439209c87e48d7eebe028a5c8f6 /tpl | |
parent | 260ff1374de71de507ffa435b8e0950aa3cb28a8 (diff) |
docs: Regenerate docs helper
Diffstat (limited to 'tpl')
-rw-r--r-- | tpl/internal/templatefuncsRegistry.go | 7 | ||||
-rw-r--r-- | tpl/os/os.go | 12 |
2 files changed, 17 insertions, 2 deletions
diff --git a/tpl/internal/templatefuncsRegistry.go b/tpl/internal/templatefuncsRegistry.go index df300a5bb..fe5dfe7ca 100644 --- a/tpl/internal/templatefuncsRegistry.go +++ b/tpl/internal/templatefuncsRegistry.go @@ -163,6 +163,10 @@ func (namespaces TemplateFuncsNamespaces) MarshalJSON() ([]byte, error) { return buf.Bytes(), nil } +var ignoreFuncs = map[string]bool{ + "Reset": true, +} + func (t *TemplateFuncsNamespace) toJSON() ([]byte, error) { var buf bytes.Buffer @@ -179,6 +183,9 @@ func (t *TemplateFuncsNamespace) toJSON() ([]byte, error) { ctxType := reflect.TypeOf(ctx) for i := 0; i < ctxType.NumMethod(); i++ { method := ctxType.Method(i) + if ignoreFuncs[method.Name] { + continue + } f := goDocFunc{ Name: method.Name, } diff --git a/tpl/os/os.go b/tpl/os/os.go index 8b195a527..2da792ac1 100644 --- a/tpl/os/os.go +++ b/tpl/os/os.go @@ -28,9 +28,17 @@ import ( // New returns a new instance of the os-namespaced template functions. func New(d *deps.Deps) *Namespace { + var readFileFs, workFs afero.Fs + + // The docshelper script does not have or need all the dependencies set up. + if d.PathSpec != nil { + readFileFs = afero.NewReadOnlyFs(afero.NewCopyOnWriteFs(d.PathSpec.BaseFs.Content.Fs, d.PathSpec.BaseFs.Work)) + workFs = d.PathSpec.BaseFs.Work + } + return &Namespace{ - readFileFs: afero.NewReadOnlyFs(afero.NewCopyOnWriteFs(d.PathSpec.BaseFs.Content.Fs, d.PathSpec.BaseFs.Work)), - workFs: d.PathSpec.BaseFs.Work, + readFileFs: readFileFs, + workFs: workFs, deps: d, } } |