2020-08-28 19:24:58 +08:00
|
|
|
package command
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/urfave/cli"
|
|
|
|
|
|
|
|
"github.com/tal-tech/go-zero/tools/goctl/rpc/ctx"
|
2020-08-28 21:22:35 +08:00
|
|
|
"github.com/tal-tech/go-zero/tools/goctl/rpc/gen"
|
2020-08-28 19:24:58 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func Rpc(c *cli.Context) error {
|
|
|
|
rpcCtx := ctx.MustCreateRpcContextFromCli(c)
|
2020-08-29 00:15:15 +08:00
|
|
|
generator := gen.NewDefaultRpcGenerator(rpcCtx)
|
2020-08-28 19:24:58 +08:00
|
|
|
rpcCtx.Must(generator.Generate())
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func RpcTemplate(c *cli.Context) error {
|
|
|
|
out := c.String("out")
|
|
|
|
idea := c.Bool("idea")
|
2020-08-29 00:15:15 +08:00
|
|
|
generator := gen.NewRpcTemplate(out, idea)
|
2020-08-28 19:24:58 +08:00
|
|
|
generator.MustGenerate()
|
|
|
|
return nil
|
|
|
|
}
|