diff --git a/tools/goctl/goctl.go b/tools/goctl/goctl.go index cec953e9..8a8f9269 100644 --- a/tools/goctl/goctl.go +++ b/tools/goctl/goctl.go @@ -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", diff --git a/tools/goctl/rpc/cli/cli.go b/tools/goctl/rpc/cli/cli.go index 7d76c1ef..236811ad 100644 --- a/tools/goctl/rpc/cli/cli.go +++ b/tools/goctl/rpc/cli/cli.go @@ -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) }