Rename pattern to regex

This commit is contained in:
2025-03-28 01:08:48 +01:00
parent 2629722f67
commit 2d523dfe64
6 changed files with 175 additions and 175 deletions

View File

@@ -11,7 +11,7 @@ import (
type ModifyCommand struct {
Name string `yaml:"name"`
Pattern string `yaml:"pattern"`
Regex string `yaml:"regex"`
Lua string `yaml:"lua"`
Files []string `yaml:"files"`
Git bool `yaml:"git"`
@@ -21,7 +21,7 @@ type ModifyCommand struct {
type CookFile []ModifyCommand
func (c *ModifyCommand) Validate() error {
if c.Pattern == "" {
if c.Regex == "" {
return fmt.Errorf("pattern is required")
}
if c.Lua == "" {
@@ -49,7 +49,7 @@ func AssociateFilesWithCommands(files []string, commands []ModifyCommand) (map[s
continue
}
if matches {
logger.Debug("Found match for file %q and command %q", file, command.Pattern)
logger.Debug("Found match for file %q and command %q", file, command.Regex)
fileCommands[file] = append(fileCommands[file], command)
associationCount++
}
@@ -147,7 +147,7 @@ func LoadCommandFromArgs(args []string) ([]ModifyCommand, error) {
}
command := ModifyCommand{
Pattern: args[0],
Regex: args[0],
Lua: args[1],
Files: args[2:],
Git: *GitFlag,