improve goctl rpc new (#1687)

master
fang duan 3 years ago committed by GitHub
parent 5d4e7c84ee
commit ff6c6558dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -513,6 +513,7 @@ var commands = []cli.Command{
{ {
Name: "new", Name: "new",
Usage: `generate rpc demo service`, Usage: `generate rpc demo service`,
UsageText: "example: goctl rpc new [options] service_name",
Flags: []cli.Flag{ Flags: []cli.Flag{
cli.StringFlag{ cli.StringFlag{
Name: "style", Name: "style",

@ -14,6 +14,10 @@ import (
// RPCNew is to generate rpc greet service, this greet service can speed // RPCNew is to generate rpc greet service, this greet service can speed
// up your understanding of the zrpc service structure // up your understanding of the zrpc service structure
func RPCNew(c *cli.Context) error { func RPCNew(c *cli.Context) error {
if c.NArg() == 0 {
cli.ShowCommandHelpAndExit(c, "new", 1)
}
rpcname := c.Args().First() rpcname := c.Args().First()
ext := filepath.Ext(rpcname) ext := filepath.Ext(rpcname)
if len(ext) > 0 { if len(ext) > 0 {

Loading…
Cancel
Save