update rpc generate sample proto file (#1709)

* update rpc generate sample proto file

* update
master
fang duan 3 years ago committed by GitHub
parent e62870e268
commit bbe1249ecb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -116,7 +116,7 @@ var commands = []cli.Command{
Flags: []cli.Flag{
cli.StringFlag{
Name: "o",
Usage: "the output api file",
Usage: "output a sample api file",
},
cli.StringFlag{
Name: "home",
@ -510,6 +510,28 @@ var commands = []cli.Command{
{
Name: "rpc",
Usage: "generate rpc code",
Flags: []cli.Flag{
cli.StringFlag{
Name: "o",
Usage: "output a sample proto file",
},
cli.StringFlag{
Name: "home",
Usage: "the goctl home path of the template, --home and --remote cannot be set at the same time, " +
"if they are, --remote has higher priority",
},
cli.StringFlag{
Name: "remote",
Usage: "the remote git repo of the template, --home and --remote cannot be set at the same time, " +
"if they are, --remote has higher priority\n\tThe git repo directory must be consistent with the " +
"https://github.com/zeromicro/go-zero-template directory structure",
},
cli.StringFlag{
Name: "branch",
Usage: "the branch of the remote repo, it does work with --remote",
},
},
Action: rpc.RPCTemplate,
Subcommands: []cli.Command{
{
Name: "new",
@ -552,7 +574,7 @@ var commands = []cli.Command{
Flags: []cli.Flag{
cli.StringFlag{
Name: "out, o",
Usage: "the target path of proto",
Usage: "the target path of proto (deprecated)",
},
cli.StringFlag{
Name: "home",

@ -8,6 +8,7 @@ import (
"github.com/urfave/cli"
"github.com/zeromicro/go-zero/tools/goctl/rpc/generator"
"github.com/zeromicro/go-zero/tools/goctl/util"
"github.com/zeromicro/go-zero/tools/goctl/util/console"
"github.com/zeromicro/go-zero/tools/goctl/util/pathx"
)
@ -63,6 +64,8 @@ func RPCNew(c *cli.Context) error {
// RPCTemplate is the entry for generate rpc template
func RPCTemplate(c *cli.Context) error {
console.Warning("deprecated: goctl rpc template -o is deprecated and will be removed in the future, use goctl rpc -o instead")
if c.NumFlags() == 0 {
cli.ShowCommandHelpAndExit(c, "template", 1)
}

Loading…
Cancel
Save