Improve config readability by removing unnecessary fields and adding omitempty

This commit is contained in:
2025-08-08 09:58:01 +02:00
parent 2a2e11d8e0
commit e1eb5eeaa6
2 changed files with 12 additions and 16 deletions

View File

@@ -427,11 +427,7 @@ func CreateExampleConfig() {
// Multiline regex example (DOTALL is auto-enabled). Captures numeric in nested XML.
{
Name: "XMLNestedValueMultiply",
Regex: `
<item>\s*
\s*<name>!any</name>\s*
\s*<value>(!num)</value>\s*
</item>`,
Regex: `<item>\s*\s*<name>!any<\/name>\s*\s*<value>(!num)<\/value>\s*\s*<\/item>`,
Lua: `* $multiply`,
Files: []string{"data/**/*.xml"},
// Demonstrates multiline regex in YAML

View File

@@ -15,17 +15,17 @@ import (
var modifyCommandLogger = logger.Default.WithPrefix("utils/modifycommand")
type ModifyCommand struct {
Name string `yaml:"name"`
Regex string `yaml:"regex"`
Regexes []string `yaml:"regexes"`
Lua string `yaml:"lua"`
Files []string `yaml:"files"`
Reset bool `yaml:"reset"`
LogLevel string `yaml:"loglevel"`
Isolate bool `yaml:"isolate"`
NoDedup bool `yaml:"nodedup"`
Disabled bool `yaml:"disable"`
Modifiers map[string]interface{} `yaml:"modifiers"`
Name string `yaml:"name,omitempty"`
Regex string `yaml:"regex,omitempty"`
Regexes []string `yaml:"regexes,omitempty"`
Lua string `yaml:"lua,omitempty"`
Files []string `yaml:"files,omitempty"`
Reset bool `yaml:"reset,omitempty"`
LogLevel string `yaml:"loglevel,omitempty"`
Isolate bool `yaml:"isolate,omitempty"`
NoDedup bool `yaml:"nodedup,omitempty"`
Disabled bool `yaml:"disable,omitempty"`
Modifiers map[string]interface{} `yaml:"modifiers,omitempty"`
}
type CookFile []ModifyCommand