feature: file namestyle (#223)
* add api filename style * new feature: config.yaml * optimize * optimize logic generation * check hanlder valid * optimize * reactor naming style * optimize * optimize test * optimize gen middleware * format Co-authored-by: anqiansong <anqiansong@xiaoheiban.cn> Co-authored-by: kim <xutao@xiaoheiban.cn>
This commit is contained in:
@@ -8,13 +8,21 @@ import (
|
||||
|
||||
const goctlDir = ".goctl"
|
||||
|
||||
func GetTemplateDir(category string) (string, error) {
|
||||
func GetGoctlHome() (string, error) {
|
||||
home, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return filepath.Join(home, goctlDir), nil
|
||||
}
|
||||
|
||||
return filepath.Join(home, goctlDir, category), nil
|
||||
func GetTemplateDir(category string) (string, error) {
|
||||
goctlHome, err := GetGoctlHome()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return filepath.Join(goctlHome, category), nil
|
||||
}
|
||||
|
||||
func InitTemplates(category string, templates map[string]string) error {
|
||||
|
||||
Reference in New Issue
Block a user