Bläddra i källkod

add goctl rpc template home flag (#871)

Co-authored-by: suzhenpeng <suzhenpeng@ecoplants.tech>
neosu 3 år sedan
förälder
incheckning
00061c2e5b
2 ändrade filer med 10 tillägg och 0 borttagningar
  1. 4 0
      tools/goctl/goctl.go
  2. 6 0
      tools/goctl/rpc/cli/cli.go

+ 4 - 0
tools/goctl/goctl.go

@@ -367,6 +367,10 @@ var (
 							Name:  "out, o",
 							Usage: "the target path of proto",
 						},
+						cli.StringFlag{
+							Name:  "home",
+							Usage: "the goctl home path of the template",
+						},
 					},
 					Action: rpc.RPCTemplate,
 				},

+ 6 - 0
tools/goctl/rpc/cli/cli.go

@@ -79,6 +79,12 @@ func RPCNew(c *cli.Context) error {
 // RPCTemplate is the entry for generate rpc template
 func RPCTemplate(c *cli.Context) error {
 	protoFile := c.String("o")
+	home := c.String("home")
+
+	if len(home) > 0 {
+		util.RegisterGoctlHome(home)
+	}
+
 	if len(protoFile) == 0 {
 		return errors.New("missing -o")
 	}