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

close #1676
This commit is contained in:
fang duan 2022-04-17 20:58:12 +08:00 committed by GitHub
parent db99addc64
commit 4382ec0e0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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")