Merge commit 'f955c625aded244864e83a872b396868a490dbc5' as 'go-enry'

This commit is contained in:
2024-09-04 16:33:41 -03:00
192 changed files with 528500 additions and 0 deletions

View File

@ -0,0 +1,30 @@
package generator
import (
"bytes"
"io/ioutil"
"gopkg.in/yaml.v2"
)
// Documentation generates regex matchers in Go for documentation files/dirs.
// It is of generator.File type.
func Documentation(fileToParse, _, outFile, tmplPath, tmplName, commit string) error {
data, err := ioutil.ReadFile(fileToParse)
if err != nil {
return err
}
var regexpList []string
if err := yaml.Unmarshal(data, &regexpList); err != nil {
return err
}
buf := &bytes.Buffer{}
err = executeTemplate(buf, tmplName, tmplPath, commit, nil, regexpList)
if err != nil {
return err
}
return formatedWrite(outFile, buf.Bytes())
}