diff options
author | Andrew M. Kuchling <amk@amk.ca> | 1998-12-18 13:56:58 +0000 |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 1998-12-18 13:56:58 +0000 |
commit | fb0649771a10146a9e0a4d172e85188a602c9fdc (patch) | |
tree | e7a11f289f0fce7bbc50184cff25534e45205e2d /Lib/tabnanny.py | |
parent | 1765870afc8d39c182c768a69b890bf5e8df7b9c (diff) | |
download | cpython-fb0649771a10146a9e0a4d172e85188a602c9fdc.tar.gz |
Added a -q ('quiet') option to tabnanny, which causes only the names of
offending files to be printed. Good for emacs `tabnanny.py *.py`
Diffstat (limited to 'Lib/tabnanny.py')
-rwxr-xr-x | Lib/tabnanny.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/tabnanny.py b/Lib/tabnanny.py index 0ffdba15f0..f68ed2da40 100755 --- a/Lib/tabnanny.py +++ b/Lib/tabnanny.py @@ -12,6 +12,7 @@ import getopt import tokenize verbose = 0 +filename_only = 0 def errprint(*args): sep = "" @@ -21,13 +22,15 @@ def errprint(*args): sys.stderr.write("\n") def main(): - global verbose + global verbose, filename_only try: - opts, args = getopt.getopt(sys.argv[1:], "v") + opts, args = getopt.getopt(sys.argv[1:], "qv") except getopt.error, msg: errprint(msg) return for o, a in opts: + if o == '-q': + filename_only = filename_only + 1 if o == '-v': verbose = verbose + 1 if not args: @@ -85,7 +88,8 @@ def check(file): print "offending line:", `line` print nag.get_msg() else: - print file, badline, `line` + if filename_only: print file + else: print file, badline, `line` return if verbose: |