summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>1998-12-18 13:56:58 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>1998-12-18 13:56:58 (GMT)
commitdc86a4e5bb537c979377d43e7eafeb473196b5e0 (patch)
treed0350bf3737d2beceea9b4158958de18cfc97760
parentea5163261e641d7cbd622e6c3bc176c464fa6522 (diff)
downloadcpython-dc86a4e5bb537c979377d43e7eafeb473196b5e0.zip
cpython-dc86a4e5bb537c979377d43e7eafeb473196b5e0.tar.gz
cpython-dc86a4e5bb537c979377d43e7eafeb473196b5e0.tar.bz2
Added a -q ('quiet') option to tabnanny, which causes only the names of
offending files to be printed. Good for emacs `tabnanny.py *.py`
-rwxr-xr-xLib/tabnanny.py10
-rwxr-xr-xTools/idle/tabnanny.py10
-rwxr-xr-xTools/scripts/tabnanny.py10
3 files changed, 21 insertions, 9 deletions
diff --git a/Lib/tabnanny.py b/Lib/tabnanny.py
index 0ffdba1..f68ed2d 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:
diff --git a/Tools/idle/tabnanny.py b/Tools/idle/tabnanny.py
index 0ffdba1..f68ed2d 100755
--- a/Tools/idle/tabnanny.py
+++ b/Tools/idle/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:
diff --git a/Tools/scripts/tabnanny.py b/Tools/scripts/tabnanny.py
index 0ffdba1..f68ed2d 100755
--- a/Tools/scripts/tabnanny.py
+++ b/Tools/scripts/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: