Fix up the logs a little
This commit is contained in:
@@ -160,3 +160,12 @@ func LoadCommandFromArgs(args []string) ([]ModifyCommand, error) {
|
||||
func LoadCommandsFromCookFiles(s string) ([]ModifyCommand, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// CountGlobsBeforeDedup counts the total number of glob patterns across all commands before deduplication
|
||||
func CountGlobsBeforeDedup(commands []ModifyCommand) int {
|
||||
count := 0
|
||||
for _, cmd := range commands {
|
||||
count += len(cmd.Files)
|
||||
}
|
||||
return count
|
||||
}
|
||||
|
@@ -18,18 +18,18 @@ func ExecuteModifications(modifications []ReplaceCommand, fileData string) (stri
|
||||
sort.Slice(modifications, func(i, j int) bool {
|
||||
return modifications[i].From > modifications[j].From
|
||||
})
|
||||
logger.Trace("Applying %d replacement commands in reverse order", len(modifications))
|
||||
logger.Trace("Preparing to apply %d replacement commands in reverse order", len(modifications))
|
||||
|
||||
executed := 0
|
||||
for _, modification := range modifications {
|
||||
fileData, err = modification.Execute(fileData)
|
||||
if err != nil {
|
||||
logger.Error("Failed to execute modification: %v", err)
|
||||
logger.Error("Failed to execute replacement: %v", err)
|
||||
continue
|
||||
}
|
||||
executed++
|
||||
}
|
||||
logger.Info("Executed %d modifications", executed)
|
||||
logger.Info("Successfully applied %d text replacements", executed)
|
||||
return fileData, executed
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user