github.com/src-d/simple-linguist@v1.7.3/internal/code-generator/generator/linguist-commit.go (about)

     1  package generator
     2  
     3  import (
     4  	"bytes"
     5  )
     6  
     7  // Commit takes a commit and builds the source file from tmplPath. It complies with type File signature.
     8  func Commit(fileToParse, samplesDir, outPath, tmplPath, tmplName, commit string) error {
     9  	buf := &bytes.Buffer{}
    10  	if err := executeTemplate(buf, tmplName, tmplPath, commit, nil, nil); err != nil {
    11  		return err
    12  	}
    13  	return formatedWrite(outPath, buf.Bytes())
    14  }