Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix "gf gen pb" api and ctrl not working well. #3076

Merged
merged 11 commits into from
Nov 8, 2023
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