goctl added

This commit is contained in:
kim
2020-07-29 17:11:41 +08:00
parent b1975d29a7
commit 121323b8c3
142 changed files with 10690 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
package validate
import (
"errors"
"fmt"
"zero/tools/goctl/api/parser"
"github.com/logrusorgru/aurora"
"github.com/urfave/cli"
)
func GoValidateApi(c *cli.Context) error {
apiFile := c.String("api")
if len(apiFile) == 0 {
return errors.New("missing -api")
}
p, err := parser.NewParser(apiFile)
if err != nil {
return err
}
_, err = p.Parse()
if err == nil {
fmt.Println(aurora.Green("api format ok"))
}
return err
}