update goctl api (#1052)

* update goctl api

* add LoadTemplate

* update new api template

* update
This commit is contained in:
Amor
2021-09-23 14:31:11 +08:00
committed by GitHub
parent f34d81ca2c
commit 41c980f00c
4 changed files with 80 additions and 1 deletions

View File

@@ -8,6 +8,7 @@ import (
"github.com/tal-tech/go-zero/core/errorx"
"github.com/tal-tech/go-zero/tools/goctl/api/apigen"
"github.com/tal-tech/go-zero/tools/goctl/api/gogen"
apinew "github.com/tal-tech/go-zero/tools/goctl/api/new"
"github.com/tal-tech/go-zero/tools/goctl/docker"
"github.com/tal-tech/go-zero/tools/goctl/kube"
mongogen "github.com/tal-tech/go-zero/tools/goctl/model/mongo/generate"
@@ -48,6 +49,9 @@ func GenTemplates(ctx *cli.Context) error {
func() error {
return apigen.GenTemplates(ctx)
},
func() error {
return apinew.GenTemplates(ctx)
},
); err != nil {
return err
}
@@ -97,6 +101,9 @@ func CleanTemplates(ctx *cli.Context) error {
func() error {
return apigen.Clean()
},
func() error {
return apinew.Clean()
},
)
if err != nil {
return err
@@ -135,6 +142,8 @@ func UpdateTemplates(ctx *cli.Context) (err error) {
return mongogen.Update()
case apigen.Category():
return apigen.Update()
case apinew.Category():
return apinew.Update()
default:
err = fmt.Errorf("unexpected category: %s", category)
return
@@ -170,6 +179,8 @@ func RevertTemplates(ctx *cli.Context) (err error) {
return mongogen.RevertTemplate(filename)
case apigen.Category():
return apigen.RevertTemplate(filename)
case apinew.Category():
return apinew.RevertTemplate(filename)
default:
err = fmt.Errorf("unexpected category: %s", category)
return