From e1eb5eeaa605dea130a8fe78ef6abf897e764a7b Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Fri, 8 Aug 2025 09:58:01 +0200 Subject: [PATCH] Improve config readability by removing unnecessary fields and adding omitempty --- main.go | 6 +----- utils/modifycommand.go | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/main.go b/main.go index 875c007..18af82b 100644 --- a/main.go +++ b/main.go @@ -427,11 +427,7 @@ func CreateExampleConfig() { // Multiline regex example (DOTALL is auto-enabled). Captures numeric in nested XML. { Name: "XMLNestedValueMultiply", - Regex: ` -\s* -\s*!any\s* -\s*(!num)\s* -`, + Regex: `\s*\s*!any<\/name>\s*\s*(!num)<\/value>\s*\s*<\/item>`, Lua: `* $multiply`, Files: []string{"data/**/*.xml"}, // Demonstrates multiline regex in YAML diff --git a/utils/modifycommand.go b/utils/modifycommand.go index 8ecdb2a..9937055 100644 --- a/utils/modifycommand.go +++ b/utils/modifycommand.go @@ -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