Move writing logic to class
This commit is contained in:
18
main.go
18
main.go
@@ -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()
|
||||
|
Reference in New Issue
Block a user