refactor file|path (#1409)

Co-authored-by: anqiansong <anqiansong@bytedance.com>
This commit is contained in:
anqiansong
2022-01-03 21:32:40 +08:00
committed by GitHub
parent 290de6aa96
commit 89ce5e492b
81 changed files with 279 additions and 245 deletions

View File

@@ -3,7 +3,7 @@ package generator
import (
"fmt"
"github.com/tal-tech/go-zero/tools/goctl/util"
"github.com/tal-tech/go-zero/tools/goctl/util/pathx"
"github.com/urfave/cli"
)
@@ -41,7 +41,7 @@ var templates = map[string]string{
// GenTemplates is the entry for command goctl template,
// it will create the specified category
func GenTemplates(_ *cli.Context) error {
return util.InitTemplates(category, templates)
return pathx.InitTemplates(category, templates)
}
// RevertTemplate restores the deleted template files
@@ -50,12 +50,12 @@ func RevertTemplate(name string) error {
if !ok {
return fmt.Errorf("%s: no such file name", name)
}
return util.CreateTemplate(category, name, content)
return pathx.CreateTemplate(category, name, content)
}
// Clean deletes all template files
func Clean() error {
return util.Clean(category)
return pathx.Clean(category)
}
// Update is used to update the template files, it will delete the existing old templates at first,
@@ -66,7 +66,7 @@ func Update() error {
return err
}
return util.InitTemplates(category, templates)
return pathx.InitTemplates(category, templates)
}
// Category returns a const string value for rpc template category