diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2011-09-08 08:17:32 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2011-09-08 08:17:32 -0400 |
commit | 22a44a4c1865fb99af1717f60e4093b3245739ba (patch) | |
tree | 092a4dcfbbc44b5726aac15d1ad03a3c3901334b /lab | |
parent | 52359c98667519628cd76a552dabb87438497c8e (diff) | |
download | python-coveragepy-22a44a4c1865fb99af1717f60e4093b3245739ba.tar.gz |
Make this helper a little easier to use
Diffstat (limited to 'lab')
-rw-r--r-- | lab/parser.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lab/parser.py b/lab/parser.py index 67c41e8..09d59f3 100644 --- a/lab/parser.py +++ b/lab/parser.py @@ -9,8 +9,8 @@ from coverage.misc import CoverageException from coverage.parser import ByteParser, CodeParser -class AdHocMain(object): - """An ad-hoc main for code parsing experiments.""" +class ParserMain(object): + """A main for code parsing experiments.""" def main(self, args): """A main function for trying the code from the command line.""" @@ -45,11 +45,13 @@ class AdHocMain(object): root = "." for root, _, _ in os.walk(root): for f in glob.glob(root + "/*.py"): - self.adhoc_one_file(options, f) + self.one_file(options, f) + elif not args: + parser.print_help() else: - self.adhoc_one_file(options, args[0]) + self.one_file(options, args[0]) - def adhoc_one_file(self, options, filename): + def one_file(self, options, filename): """Process just one file.""" if options.dis or options.chunks: @@ -173,5 +175,5 @@ class AdHocMain(object): return arc_width, arc_chars if __name__ == '__main__': - AdHocMain().main(sys.argv[1:]) + ParserMain().main(sys.argv[1:]) |