if __name__ == '__main__':
try:
- (optlist, args) = getopt.getopt(sys.argv[1:], 'd:ns:x')
+ (optlist, args) = getopt.getopt(sys.argv[1:], 'd:ns:Sx')
except getopt.GetoptError:
sys.stderr.write("usage: filterator [-d dir] [-n] [-s size] [-x]\n")
sys.exit(2)
- nofilter = debug = 0
+ stats = nofilter = debug = 0
minsize = 5
linecounts = {}
for (opt, val) in optlist:
nofilter = 1
elif opt == '-s':
minsize = int(val)
+ elif opt == '-S':
+ stats = 1
elif opt == '-x':
debug = 1
if minsize:
state.filter_by_size(minsize)
- report_common(state)
+ if stats:
+ print "%d overlaps" % state.segment_count()
+ for (tree, totallines) in state.trees.items():
+ lines = state.line_count(tree)
+ print "%s:%d:%d" % (tree, lines, state.trees[tree])
+ else:
+ report_common(state)