diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2012-09-09 17:27:34 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2012-09-09 17:27:34 +0100 |
commit | fe10d23a7c6eb6fbe37c3fba1afc10817629a60a (patch) | |
tree | 051867a5d54a5cf1e041b891d502d2edcface7d7 | |
parent | b3c5fc58b937f662bd1b389d6e7cb5c8a5d2c555 (diff) | |
download | luacov-old_master.tar.gz |
Support exclusion patterns as well as inclusion patterns on the command lineold_master
-rwxr-xr-x | src/bin/luacov | 21 |
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 |