From c57e967a612201bf4edee2bdecfd89e08a2afc19 Mon Sep 17 00:00:00 2001 From: lonless9 Date: Fri, 6 Jun 2025 01:30:03 +0800 Subject: dec pattern --- xmake/plugins/show/lists/targets.lua | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/xmake/plugins/show/lists/targets.lua b/xmake/plugins/show/lists/targets.lua index ce398fc77..57cf78b53 100644 --- a/xmake/plugins/show/lists/targets.lua +++ b/xmake/plugins/show/lists/targets.lua @@ -29,19 +29,17 @@ import(".showlist") function main() config.load() - local group_pattern = option.get("group") - if group_pattern then - group_pattern = "^" .. path.pattern(group_pattern) .. "$" - end + local group_pattern = option.get("group") and ("^" .. path.pattern(option.get("group")) .. "$") local targets = {} for name, target in pairs(project.targets()) do local group = target:get("group") if (target:is_default() and not group_pattern) or - (group_pattern and group and (group:match(group_pattern) or - table.find_first_if(group:split("[/\\]"), function(i, component) - return component:match(group_pattern) - end))) then + (group_pattern and group and (function() + for component in group:gmatch("[^/\\\\]+") do + if component:match(group_pattern) then return true end + end + end)()) then table.insert(targets, name) end end -- cgit v1.3.1