summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2012-09-09 17:27:34 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2012-09-09 17:27:34 +0100
commitfe10d23a7c6eb6fbe37c3fba1afc10817629a60a (patch)
tree051867a5d54a5cf1e041b891d502d2edcface7d7
parentb3c5fc58b937f662bd1b389d6e7cb5c8a5d2c555 (diff)
downloadluacov-old_master.tar.bz2
Support exclusion patterns as well as inclusion patterns on the command lineold_master
-rwxr-xr-xsrc/bin/luacov21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/bin/luacov b/src/bin/luacov
index 2dd3c2d..71b291e 100755
--- a/src/bin/luacov
+++ b/src/bin/luacov
@@ -14,8 +14,19 @@ local report = io.open("luacov.report.out", "w")
-- only report on files specified on the command line
local patterns = {}
+local exclude_patterns = {}
+local exclude_next = false
for i = 1, #arg do
- patterns[i] = arg[i]
+ if arg[i] == "-X" then
+ exclude_next = true
+ else
+ if exclude_next then
+ exclude_patterns[#exclude_patterns+1] = arg[i]
+ exclude_next = false
+ else
+ patterns[#patterns+1] = arg[i]
+ end
+ end
end
local names = {}
@@ -32,6 +43,14 @@ for filename, _ in pairs(data) do
end
end
if include then
+ for _, p in ipairs(exclude_patterns) do
+ if path:match(p) then
+ include = false
+ break
+ end
+ end
+ end
+ if include then
table.insert(names, filename)
end
end