初版提交

This commit is contained in:
2025-09-24 00:54:08 +08:00
commit ca040bc2b9
15 changed files with 1129 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
package config
type ErlangGeneratorCfg struct {
TemplateDir string `yaml:"template_dir" json:"template_dir"` // 模板文件存放地址
Keywords []ErlangTemKey `yaml:"keywords" json:"keywords"`
}
type ErlangTemKey struct {
MainTemplate string `yaml:"main_template" json:"main_template"` // 主模板
Filename string `yaml:"filename" json:"filename"` // _port.erl
OutputDir string `yaml:"output_dir" json:"output_dir"` // 输出地址
OutFileExt string `yaml:"out_file_ext" json:"out_file_ext"` // .cfg
DefaultArgs []DefaultArg `yaml:"default_args" json:"default_args"` // 默认模板参数
}
type DefaultArg struct {
Key string `yaml:"key" json:"key"`
Value string `yaml:"val" json:"Value"`
}
func DefaultErlConfig() *ErlangGeneratorCfg {
return &ErlangGeneratorCfg{
TemplateDir: "./templates",
Keywords: []ErlangTemKey{
{
MainTemplate: "port.tpl",
Filename: "*_port.erl",
OutputDir: "output",
OutFileExt: ".cfg",
DefaultArgs: []DefaultArg{
{
Key: "template",
Value: "_Z_SESSION",
},
{
Key: "project",
Value: "Project",
},
},
},
},
}
}