mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
cmd/ent: Attach Funcs for ent new templates (#3336)
This commit is contained in:
@@ -101,9 +101,11 @@ func NewCmd() *cobra.Command {
|
||||
tmpl *template.Template
|
||||
)
|
||||
if tmplPath != "" {
|
||||
tmpl, err = template.ParseFiles(tmplPath)
|
||||
tmpl = template.New(filepath.Base(tmplPath)).Funcs(gen.Funcs)
|
||||
tmpl, err = tmpl.ParseFiles(tmplPath)
|
||||
} else {
|
||||
tmpl, err = template.New("schema").Parse(defaultTemplate)
|
||||
tmpl = template.New("schema").Funcs(gen.Funcs)
|
||||
tmpl, err = tmpl.Parse(defaultTemplate)
|
||||
}
|
||||
if err != nil {
|
||||
log.Fatalln(fmt.Errorf("ent/new: could not parse template %w", err))
|
||||
|
||||
Reference in New Issue
Block a user