Move writing logic to class

This commit is contained in:
2024-09-12 15:44:35 +02:00
parent b9306ce53d
commit 3577ecfaaf
2 changed files with 19 additions and 12 deletions

18
main.go
View File

@@ -48,11 +48,11 @@ func main() {
outdir := flag.String("o", ".", "Output directory")
flag.Parse()
files := flag.Args()
// if len(files) == 0 {
// Error.Printf("No files specified")
// flag.Usage()
// return
// }
if len(files) == 0 {
Error.Printf("No files specified")
flag.Usage()
return
}
ltemplate, err := template.New("class").Funcs(fns).Parse(templatestr)
if err != nil {
@@ -70,13 +70,7 @@ func main() {
Error.Printf("Error parsing file: %v", err)
return
}
outfile, err := class.GetOutFile(*outdir)
if err != nil {
Error.Printf("Error creating output file: %v", err)
return
}
ltemplate.Execute(outfile, class)
class.Write(*outdir, ltemplate)
}(file)
}
wg.Wait()