Add goctl kotlin support

This commit is contained in:
stevenzack
2020-08-14 09:02:32 +08:00
committed by Kevin Wan
parent 4b636cd293
commit 926d746df5
6 changed files with 298 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
package ktgen
import (
"errors"
"github.com/tal-tech/go-zero/core/lang"
"github.com/tal-tech/go-zero/tools/goctl/api/parser"
"github.com/urfave/cli"
)
func KtCommand(c *cli.Context) error {
apiFile := c.String("api")
if apiFile == "" {
return errors.New("missing -api")
}
dir := c.String("dir")
if dir == "" {
return errors.New("missing -dir")
}
pkg := c.String("pkg")
if pkg == "" {
return errors.New("missing -pkg")
}
p, e := parser.NewParser(apiFile)
if e != nil {
return e
}
api,e:=p.Parse()
if e!=nil {
return e
}
lang.Must(genBase(dir,pkg,api))
lang.Must(genApi(dir,pkg, api))
return nil
}