Skip to content

Commit

Permalink
feat(cmd/gf): project template updates for command gf init (#3928)
Browse files Browse the repository at this point in the history
  • Loading branch information
gqcn authored Nov 17, 2024
1 parent bcfcda7 commit ec6c537
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions cmd/gf/internal/cmd/genctrl/genctrl_generate_ctrl.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (c *controllerGenerator) doGenerateCtrlNewByModuleAndVersion(
if err = gfile.PutContents(moduleFilePath, gstr.TrimLeft(content)); err != nil {
return err
}
mlog.Printf(`generated: %s`, moduleFilePath)
mlog.Printf(`generated: %s`, gfile.RealPath(moduleFilePath))
}
if !gfile.Exists(moduleFilePathNew) {
content := gstr.ReplaceByMap(consts.TemplateGenCtrlControllerNewEmpty, g.MapStrStr{
Expand All @@ -99,7 +99,7 @@ func (c *controllerGenerator) doGenerateCtrlNewByModuleAndVersion(
if err = gfile.PutContents(moduleFilePathNew, gstr.TrimLeft(content)); err != nil {
return err
}
mlog.Printf(`generated: %s`, moduleFilePathNew)
mlog.Printf(`generated: %s`, gfile.RealPath(moduleFilePathNew))
}
filePaths, err := gfile.ScanDir(dstModuleFolderPath, "*.go", false)
if err != nil {
Expand Down Expand Up @@ -161,7 +161,7 @@ func (c *controllerGenerator) doGenerateCtrlItem(dstModuleFolderPath string, ite
return err
}
}
mlog.Printf(`generated: %s`, methodFilePath)
mlog.Printf(`generated: %s`, gfile.RealPath(methodFilePath))
return
}

Expand Down Expand Up @@ -221,7 +221,7 @@ func (c *controllerGenerator) doGenerateCtrlMergeItem(dstModuleFolderPath string
if err = gfile.PutContentsAppend(ctrlFilePath, ctrlFileItem.controllers.String()); err != nil {
return err
}
mlog.Printf(`generated: %s`, ctrlFilePath)
mlog.Printf(`generated: %s`, gfile.RealPath(ctrlFilePath))
}
return
}
2 changes: 1 addition & 1 deletion cmd/gf/internal/cmd/genctrl/genctrl_generate_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (c *apiInterfaceGenerator) doGenerate(apiModuleFolderPath string, module st
"{Interfaces}": gstr.TrimRightStr(interfaceDefinition, "\n", 2),
}))
err = gfile.PutContents(moduleFilePath, interfaceContent)
mlog.Printf(`generated: %s`, moduleFilePath)
mlog.Printf(`generated: %s`, gfile.RealPath(moduleFilePath))
return
}

Expand Down
8 changes: 4 additions & 4 deletions cmd/gf/internal/cmd/genctrl/genctrl_generate_sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (c *apiSdkGenerator) doGenerateSdkPkgFile(sdkFolderPath string) (err error)
"{PkgName}": pkgName,
}))
err = gfile.PutContents(pkgFilePath, fileContent)
mlog.Printf(`generated: %s`, pkgFilePath)
mlog.Printf(`generated: %s`, gfile.RealPath(pkgFilePath))
return
}

Expand Down Expand Up @@ -130,9 +130,9 @@ func (c *apiSdkGenerator) doGenerateSdkIClient(
if isDirty {
err = gfile.PutContents(iClientFilePath, fileContent)
if isExist {
mlog.Printf(`updated: %s`, iClientFilePath)
mlog.Printf(`updated: %s`, gfile.RealPath(iClientFilePath))
} else {
mlog.Printf(`generated: %s`, iClientFilePath)
mlog.Printf(`generated: %s`, gfile.RealPath(iClientFilePath))
}
}
return
Expand Down Expand Up @@ -183,7 +183,7 @@ func (c *apiSdkGenerator) doGenerateSdkImplementer(
implementerFileContent += "\n"
}
err = gfile.PutContents(implementerFilePath, implementerFileContent)
mlog.Printf(`generated: %s`, implementerFilePath)
mlog.Printf(`generated: %s`, gfile.RealPath(implementerFilePath))
return
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/gf/internal/cmd/gendao/gendao_dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func generateDaoIndex(in generateDaoIndexInput) {
mlog.Fatalf("writing content to '%s' failed: %v", path, err)
} else {
utils.GoFmt(path)
mlog.Print("generated:", path)
mlog.Print("generated:", gfile.RealPath(path))
}
}
}
Expand Down Expand Up @@ -157,7 +157,7 @@ func generateDaoInternal(in generateDaoInternalInput) {
mlog.Fatalf("writing content to '%s' failed: %v", path, err)
} else {
utils.GoFmt(path)
mlog.Print("generated:", path)
mlog.Print("generated:", gfile.RealPath(path))
}
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/gf/internal/cmd/gendao/gendao_do.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func generateDo(ctx context.Context, in CGenDaoInternalInput) {
mlog.Fatalf(`writing content to "%s" failed: %v`, doFilePath, err)
} else {
utils.GoFmt(doFilePath)
mlog.Print("generated:", doFilePath)
mlog.Print("generated:", gfile.RealPath(doFilePath))
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/gf/internal/cmd/gendao/gendao_entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func generateEntity(ctx context.Context, in CGenDaoInternalInput) {
mlog.Fatalf("writing content to '%s' failed: %v", entityFilePath, err)
} else {
utils.GoFmt(entityFilePath)
mlog.Print("generated:", entityFilePath)
mlog.Print("generated:", gfile.RealPath(entityFilePath))
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/gf/internal/cmd/genpbentity/genpbentity.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ func generatePbEntityContentFile(ctx context.Context, in CGenPbEntityInternalInp
if err := gfile.PutContents(path, strings.TrimSpace(entityContent)); err != nil {
mlog.Fatalf("writing content to '%s' failed: %v", path, err)
} else {
mlog.Print("generated:", path)
mlog.Print("generated:", gfile.RealPath(path))
}
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/gf/internal/packed/template-mono-app.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cmd/gf/internal/packed/template-mono.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cmd/gf/internal/packed/template-single.go

Large diffs are not rendered by default.

0 comments on commit ec6c537

Please sign in to comment.