Skip to content

Commit

Permalink
fix api and ctrl not working well.
Browse files Browse the repository at this point in the history
  • Loading branch information
joy999 committed Oct 22, 2023
1 parent acf2307 commit bfc87d2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cmd/gf/internal/cmd/genpb/genpb.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import (
type (
CGenPb struct{}
CGenPbInput struct {
g.Meta `name:"pb" config:"{CGenPbConfig}" brief:"{CGenPbBrief}" eg:"{CGenPbEg}"`
Path string `name:"path" short:"p" dc:"protobuf file folder path" d:"manifest/protobuf"`
OutputApi string `name:"api" short:"a" dc:"output folder path storing generated go files of api" d:"api"`
OutputCtrl string `name:"ctrl" short:"c" dc:"output folder path storing generated go files of controller" d:"internal/controller"`
g.Meta `name:"pb" config:"{CGenPbConfig}" brief:"{CGenPbBrief}" eg:"{CGenPbEg}"`
Path string `name:"path" short:"p" dc:"protobuf file folder path" d:"manifest/protobuf"`
Api string `name:"api" short:"a" dc:"output folder path storing generated go files of api" d:"api"`
Ctrl string `name:"ctrl" short:"c" dc:"output folder path storing generated go files of controller" d:"internal/controller"`
}
CGenPbOutput struct{}
)
Expand Down Expand Up @@ -68,20 +68,20 @@ func (c CGenPb) Pb(ctx context.Context, in CGenPbInput) (out *CGenPbOutput, err
}
}
// output path checks.
outputApiPath := gfile.RealPath(in.OutputApi)
outputApiPath := gfile.RealPath(in.Api)
if outputApiPath == "" {
if isParsingPWD {
outputApiPath = protoPath
} else {
mlog.Fatalf(`output api folder "%s" does not exist`, in.OutputApi)
mlog.Fatalf(`output api folder "%s" does not exist`, in.Api)
}
}
outputCtrlPath := gfile.RealPath(in.OutputCtrl)
outputCtrlPath := gfile.RealPath(in.Ctrl)
if outputCtrlPath == "" {
if isParsingPWD {
outputCtrlPath = ""
} else {
mlog.Fatalf(`output controller folder "%s" does not exist`, in.OutputCtrl)
mlog.Fatalf(`output controller folder "%s" does not exist`, in.Ctrl)
}
}

Expand Down

0 comments on commit bfc87d2

Please sign in to comment.