Skip to content

Commit

Permalink
test: add -q to our parser helper tool
Browse files Browse the repository at this point in the history
  • Loading branch information
Ned Batchelder committed Oct 22, 2024
1 parent 7a627a6 commit 60a5d6f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lab/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ def main(self, args):
"-R", action="store_true", dest="recursive",
help="Recurse to find source files"
)
parser.add_option(
"-q", action="store_true", dest="quiet",
help="Suppress output"
)
parser.add_option(
"-s", action="store_true", dest="source",
help="Show analyzed source"
Expand All @@ -50,6 +54,8 @@ def main(self, args):
root = "."
for root, _, _ in os.walk(root):
for f in glob.glob(root + "/*.py"):
if not options.quiet:
print(f"Parsing {f}")
self.one_file(options, f)
elif not args:
parser.print_help()
Expand Down Expand Up @@ -121,7 +127,8 @@ def one_file(self, options, filename):
else:
a = ""

print("%4d %s%s %s" % (lineno, "".join(marks), a, ltext))
if not options.quiet:
print("%4d %s%s %s" % (lineno, "".join(marks), a, ltext))

def arc_ascii_art(self, arcs):
"""Draw arcs as ascii art.
Expand Down

0 comments on commit 60a5d6f

Please sign in to comment.