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

close #1676
master
fang duan 3 years ago committed by GitHub
parent db99addc64
commit 4382ec0e0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

Loading…
Cancel
Save