summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2013-04-17 12:53:26 +0100
committerLars Wirzenius <liw@liw.fi>2013-04-17 12:53:26 +0100
commitf61862c2daaae7acc07a8cfe1bb7d38d344c4a79 (patch)
tree1f089a25ff22d6b6307d0b99f83fa45af281074f
parenta0e631308e5d6caa558c02f1efc1b823d0f36788 (diff)
downloadlicense-summary-f61862c2daaae7acc07a8cfe1bb7d38d344c4a79.tar.gz
Add --exclude option
-rwxr-xr-xlicense-summary11
1 files changed, 11 insertions, 0 deletions
diff --git a/license-summary b/license-summary
index 1103f13..05ed6d1 100755
--- a/license-summary
+++ b/license-summary
@@ -30,6 +30,13 @@ __version__ = '0.0'
class LicenseSummary(cliapp.Application):
+ def add_settings(self):
+ self.settings.string_list(
+ ['exclude', 'e'],
+ 'exclude files matching REGEXP '
+ 'from report of files without a license summary',
+ metavar='REGEXP')
+
def setup(self):
self.pat = re.compile(r'=\*= [Ll]icen[cs]es?:\s*(?P<summary>\S.*\S)\s*=\*=')
self.summaries = {}
@@ -43,6 +50,10 @@ class LicenseSummary(cliapp.Application):
self.output.write('\t%s\n' % filename)
if filename in self.filenames:
self.filenames.remove(filename)
+ for pattern in self.settings['exclude']:
+ remove = [x for x in self.filenames if re.search(pattern, x)]
+ for filename in remove:
+ self.filenames.remove(filename)
if self.filenames:
self.output.write('no summary (%d):\n' % len(self.filenames))
for filename in sorted(self.filenames):