Implement regexes, an entry option allow for same modification to apply to multiple regexes and variables that can be referenced in lua
This commit is contained in:
@@ -15,15 +15,17 @@ import (
|
||||
var modifyCommandLogger = logger.Default.WithPrefix("utils/modifycommand")
|
||||
|
||||
type ModifyCommand struct {
|
||||
Name string `yaml:"name"`
|
||||
Regex string `yaml:"regex"`
|
||||
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"`
|
||||
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"`
|
||||
}
|
||||
|
||||
type CookFile []ModifyCommand
|
||||
@@ -31,7 +33,7 @@ type CookFile []ModifyCommand
|
||||
func (c *ModifyCommand) Validate() error {
|
||||
validateLogger := modifyCommandLogger.WithPrefix("Validate").WithField("commandName", c.Name)
|
||||
validateLogger.Debug("Validating command")
|
||||
if c.Regex == "" {
|
||||
if c.Regex == "" && len(c.Regexes) == 0 {
|
||||
validateLogger.Error("Validation failed: Regex pattern is required")
|
||||
return fmt.Errorf("pattern is required")
|
||||
}
|
||||
|
Reference in New Issue
Block a user