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

View File

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