43 lines
1.4 KiB
Go
43 lines
1.4 KiB
Go
// config/generator_config.go
|
|
package config
|
|
|
|
type GeneratorConfig struct {
|
|
// 扫描配置
|
|
ScanDir string `yaml:"scan_dir" json:"scan_dir"`
|
|
FilePatterns []string `yaml:"file_patterns" json:"file_patterns"`
|
|
OutputFile string `yaml:"output_file" json:"output_file"`
|
|
|
|
// 注解关键词配置
|
|
Keywords []KeywordConfig `yaml:"keywords" json:"keywords"`
|
|
|
|
// 模板配置
|
|
TemplateFile string `yaml:"template_file" json:"template_file"`
|
|
|
|
// 忽略的目录
|
|
IgnoreDirs []string `yaml:"ignore_dirs" json:"ignore_dirs"`
|
|
}
|
|
|
|
type KeywordConfig struct {
|
|
Name string `yaml:"name" json:"name"`
|
|
Description string `yaml:"description" json:"description"`
|
|
Required bool `yaml:"required" json:"required"`
|
|
}
|
|
|
|
// 默认配置
|
|
func DefaultConfig() *GeneratorConfig {
|
|
return &GeneratorConfig{
|
|
ScanDir: "./",
|
|
FilePatterns: []string{"*.erl", "*.hrl"},
|
|
OutputFile: "./generated/app.config",
|
|
TemplateFile: "./templates/config_template.tplerl",
|
|
IgnoreDirs: []string{".git", "node_modules", "_build", "deps"},
|
|
Keywords: []KeywordConfig{
|
|
{Name: "config", Description: "配置项定义", Required: true},
|
|
{Name: "module", Description: "模块配置", Required: false},
|
|
{Name: "function", Description: "函数配置", Required: false},
|
|
{Name: "param", Description: "参数配置", Required: false},
|
|
{Name: "type", Description: "类型配置", Required: false},
|
|
},
|
|
}
|
|
}
|