Refine the template to fix excessive newlines

This commit is contained in:
2024-09-12 00:40:20 +02:00
parent 2e10e11ab9
commit 440a6e33e6
4 changed files with 67 additions and 22 deletions

View File

@@ -1,10 +1,16 @@
package main
import (
"fmt"
"os"
)
type (
Class struct {
ClassName string
Fields []Field
Methods []Method
ClassName string
Fields []Field
Methods []Method
Constructors []Constructor
}
Field struct {
Name string
@@ -26,4 +32,20 @@ type (
Type string
Comment string
}
Constructor struct {
Params []Param
Comment string
}
)
func (c *Class) GetOutFile() (*os.File, error) {
if c.ClassName == "" {
return nil, fmt.Errorf("ClassName is empty")
}
filename := fmt.Sprintf("%s.lua", c.ClassName)
f, err := os.Create(filename)
if err != nil {
return nil, err
}
return f, nil
}