summaryrefslogtreecommitdiff
path: root/src/lua-script/script.h
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.h
parent9beef6bdace1e70b5f3097896a955892e324800a (diff)
implement pattern-matching for noprocess
Diffstat (limited to 'src/lua-script/script.h')
-rw-r--r--src/lua-script/script.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/lua-script/script.h b/src/lua-script/script.h
index e29003f..9406097 100644
--- a/src/lua-script/script.h
+++ b/src/lua-script/script.h
@@ -237,13 +237,32 @@ const char *argent_script =
" return false\n"
" end\n"
"\n"
+ " function should_process(filename, parent)\n"
+ " if not string.match(filename, '%.lua$') then\n"
+ " return false\n"
+ " end\n"
+ " \n"
+ " if should_ignore(filename, parent) then\n"
+ " return false\n"
+ " end\n"
+ "\n"
+ " for pattern in pairs(argent.config.noprocess) do\n"
+ " if string.match(filename, pattern)\n"
+ " or string.match(parent..filename, pattern) then\n"
+ " return false\n"
+ " end\n"
+ " end\n"
+ "\n"
+ " return true\n"
+ " end\n"
+ "\n"
" function process_file(filename, parent)\n"
" if should_ignore(filename, parent) then\n"
" argent.log('debug', fmt('will not process file %q', parent..filename))\n"
" return\n"
" end\n"
"\n"
- " if string.match(filename, '%.lua$') and not argent.config.noprocess[filename] then\n"
+ " if should_process(filename, parent) then\n"
" argent.log('debug', fmt('processing %q as lua file', parent..filename))\n"
" process_lua_file(filename, parent)\n"
" else\n"