From 4382ec0e0d1c60173e362fef5937b15592f978cb Mon Sep 17 00:00:00 2001 From: fang duan Date: Sun, 17 Apr 2022 20:58:12 +0800 Subject: [PATCH] show help when running goctl api without any flags (#1678) close #1676 --- tools/goctl/api/apigen/gen.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/goctl/api/apigen/gen.go b/tools/goctl/api/apigen/gen.go index e57b603e..9b2c8382 100644 --- a/tools/goctl/api/apigen/gen.go +++ b/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")