summaryrefslogtreecommitdiff
path: root/src/lua-script/script.lua
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-01-04 16:03:43 -0600
committersanine <sanine.not@pm.me>2022-01-04 16:03:43 -0600
commit43347c36ec9b1f5e988cf6c89edd4d901061a303 (patch)
tree57a227b6fceb47b46f1fa7456142e66624a15247 /src/lua-script/script.lua
parent9beef6bdace1e70b5f3097896a955892e324800a (diff)
implement pattern-matching for noprocess
Diffstat (limited to 'src/lua-script/script.lua')
-rw-r--r--src/lua-script/script.lua21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/lua-script/script.lua b/src/lua-script/script.lua
index c6c2ecb..e44ece5 100644
--- a/src/lua-script/script.lua
+++ b/src/lua-script/script.lua
@@ -236,13 +236,32 @@ return function(config)
return false
end
+ function should_process(filename, parent)
+ if not string.match(filename, '%.lua$') then
+ return false
+ end
+
+ if should_ignore(filename, parent) then
+ return false
+ end
+
+ for pattern in pairs(argent.config.noprocess) do
+ if string.match(filename, pattern)
+ or string.match(parent..filename, pattern) then
+ return false
+ end
+ end
+
+ return true
+ end
+
function process_file(filename, parent)
if should_ignore(filename, parent) then
argent.log('debug', fmt('will not process file %q', parent..filename))
return
end
- if string.match(filename, '%.lua$') and not argent.config.noprocess[filename] then
+ if should_process(filename, parent) then
argent.log('debug', fmt('processing %q as lua file', parent..filename))
process_lua_file(filename, parent)
else