فهرست منبع

show help when running goctl api without any flags (#1678)

close #1676
fang duan 3 سال پیش
والد
کامیت
4382ec0e0d
1فایلهای تغییر یافته به همراه4 افزوده شده و 0 حذف شده
  1. 4 0
      tools/goctl/api/apigen/gen.go

+ 4 - 0
tools/goctl/api/apigen/gen.go

@@ -19,6 +19,10 @@ var apiTemplate string
 
 // ApiCommand create api template file
 func ApiCommand(c *cli.Context) error {
+	if c.NumFlags() == 0 {
+		cli.ShowAppHelpAndExit(c, 1)
+	}
+
 	apiFile := c.String("o")
 	if len(apiFile) == 0 {
 		return errors.New("missing -o")