Add filter flag

This commit is contained in:
2025-03-28 11:20:35 +01:00
parent e8f16dda2b
commit 8a86ae2f40
3 changed files with 21 additions and 1 deletions

View File

@@ -53,7 +53,6 @@ func main() {
fmt.Fprintf(os.Stderr, " You can use any valid Lua code, including if statements, loops, etc.\n")
fmt.Fprintf(os.Stderr, " Glob patterns are supported for file selection (*.xml, data/**.xml, etc.)\n")
}
// TODO: Implement -f flag for filtering recipes by name
// TODO: Fix bed shitting when doing *.yml in barotrauma directory
// TODO: Fix disaster:
// fatal error: concurrent map writes
@@ -111,6 +110,12 @@ func main() {
return
}
if *utils.Filter != "" {
logger.Info("Filtering commands by name: %s", *utils.Filter)
commands = utils.FilterCommands(commands, *utils.Filter)
logger.Info("Filtered %d commands", len(commands))
}
// Then aggregate all the globs and deduplicate them
globs := utils.AggregateGlobs(commands)
logger.Debug("Aggregated %d globs before deduplication", utils.CountGlobsBeforeDedup(commands))