diff --git a/cmd/commands/create_entity.go b/cmd/commands/create_entity.go new file mode 100644 index 0000000..376d589 --- /dev/null +++ b/cmd/commands/create_entity.go @@ -0,0 +1,11 @@ +package commands + +import ( + "github.com/urfave/cli/v2" +) + +func CreateEntity(c *cli.Context) error { + args := c.Args() + + args.Get(0) +} diff --git a/scripts/gen/gen.go b/scripts/gen/gen.go index c75521d..ead4ae5 100644 --- a/scripts/gen/gen.go +++ b/scripts/gen/gen.go @@ -55,10 +55,9 @@ func main() { if err != nil { panic(err) } - os.MkdirAll("../internal/repositories", os.ModePerm) + _ = os.MkdirAll("../internal/repositories", os.ModePerm) var camels []string var pascals []string - var iocStr string var createdCount int for _, dir := range dirs { name := dir.Name() @@ -79,7 +78,6 @@ func main() { fmt.Println("跳过 " + dir.Name()) continue } - iocStr += "\tioc.MustSingleton(New" + pascal + "Repository)\n" repository := "../internal/repositories/" + dir.Name() if PathExists(repository) { fmt.Println("跳过 " + dir.Name()) @@ -87,21 +85,11 @@ func main() { code := strings.ReplaceAll(repoStub, "{{pascal}}", pascal) code = strings.ReplaceAll(code, "{{camel}}", camel) code = strings.ReplaceAll(code, "{{label}}", label) - os.WriteFile("../internal/repositories/"+dir.Name(), []byte(code), os.ModePerm) + _ = os.WriteFile("../internal/repositories/"+dir.Name(), []byte(code), os.ModePerm) fmt.Println("创建 " + dir.Name()) createdCount++ } } - - if createdCount > 0 { - os.WriteFile("../internal/repositories/ioc.go", []byte(`package repositories - -import "sorbet/pkg/ioc" - -func init() { -`+iocStr+`} -`), os.ModePerm) - } } func PathExists(path string) bool {