MCPcopy Index your code
hub / github.com/factorapp/factor / writeTemplate

Function writeTemplate

cmd/init.go:160–174  ·  view source on GitHub ↗
(filePath string, templateName string)

Source from the content-addressed store, hash-verified

158 return err
159}
160func writeTemplate(filePath string, templateName string) error {
161 gofile, err := os.Create(filePath)
162 if err != nil {
163 log.Println("ERROR", err)
164 return err
165 }
166 defer gofile.Close()
167 tpl := template.Must(template.New("component").Parse(templateName))
168 // TODO - get the gopath of cwd and pass it in a context below to this call
169 err = tpl.Execute(gofile, nil)
170 if err != nil {
171 return err
172 }
173 return nil
174}
175func makeDirectories(cwd string) error {
176 for _, dir := range directories {
177 err := os.MkdirAll(filepath.Join(cwd, appName, dir), 0755)

Callers 1

populateAppFunction · 0.85

Calls 1

CreateMethod · 0.80

Tested by

no test coverage detected