optimized

This commit is contained in:
MaxToby
2021-01-16 11:53:17 +08:00
parent ce24620329
commit d06684494a
8 changed files with 141 additions and 21 deletions

View File

@ -10,6 +10,7 @@ import (
func Generator(ctx *cli.Context) error {
pkg := ctx.String("package")
fileName := ctx.String("filename")
std, err := ioutil.ReadAll(os.Stdin)
if err != nil {
return err
@ -17,7 +18,11 @@ func Generator(ctx *cli.Context) error {
var plugin generate.Plugin
plugin.ParentPackage = pkg
plugin.FileName = fileName
if len(plugin.FileName) == 0 {
plugin.FileName = "rest.swagger.json"
}
err = json.Unmarshal(std, &plugin)
if err != nil {
return err