File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212import tokenize
1313
1414verbose = 0
15+ filename_only = 0
1516
1617def errprint (* args ):
1718 sep = ""
@@ -21,13 +22,15 @@ def errprint(*args):
2122 sys .stderr .write ("\n " )
2223
2324def main ():
24- global verbose
25+ global verbose , filename_only
2526 try :
26- opts , args = getopt .getopt (sys .argv [1 :], "v " )
27+ opts , args = getopt .getopt (sys .argv [1 :], "qv " )
2728 except getopt .error , msg :
2829 errprint (msg )
2930 return
3031 for o , a in opts :
32+ if o == '-q' :
33+ filename_only = filename_only + 1
3134 if o == '-v' :
3235 verbose = verbose + 1
3336 if not args :
@@ -85,7 +88,8 @@ def check(file):
8588 print "offending line:" , `line`
8689 print nag .get_msg ()
8790 else :
88- print file , badline , `line`
91+ if filename_only : print file
92+ else : print file , badline , `line`
8993 return
9094
9195 if verbose :
Original file line number Diff line number Diff line change 1212import tokenize
1313
1414verbose = 0
15+ filename_only = 0
1516
1617def errprint (* args ):
1718 sep = ""
@@ -21,13 +22,15 @@ def errprint(*args):
2122 sys .stderr .write ("\n " )
2223
2324def main ():
24- global verbose
25+ global verbose , filename_only
2526 try :
26- opts , args = getopt .getopt (sys .argv [1 :], "v " )
27+ opts , args = getopt .getopt (sys .argv [1 :], "qv " )
2728 except getopt .error , msg :
2829 errprint (msg )
2930 return
3031 for o , a in opts :
32+ if o == '-q' :
33+ filename_only = filename_only + 1
3134 if o == '-v' :
3235 verbose = verbose + 1
3336 if not args :
@@ -85,7 +88,8 @@ def check(file):
8588 print "offending line:" , `line`
8689 print nag .get_msg ()
8790 else :
88- print file , badline , `line`
91+ if filename_only : print file
92+ else : print file , badline , `line`
8993 return
9094
9195 if verbose :
Original file line number Diff line number Diff line change 1212import tokenize
1313
1414verbose = 0
15+ filename_only = 0
1516
1617def errprint (* args ):
1718 sep = ""
@@ -21,13 +22,15 @@ def errprint(*args):
2122 sys .stderr .write ("\n " )
2223
2324def main ():
24- global verbose
25+ global verbose , filename_only
2526 try :
26- opts , args = getopt .getopt (sys .argv [1 :], "v " )
27+ opts , args = getopt .getopt (sys .argv [1 :], "qv " )
2728 except getopt .error , msg :
2829 errprint (msg )
2930 return
3031 for o , a in opts :
32+ if o == '-q' :
33+ filename_only = filename_only + 1
3134 if o == '-v' :
3235 verbose = verbose + 1
3336 if not args :
@@ -85,7 +88,8 @@ def check(file):
8588 print "offending line:" , `line`
8689 print nag .get_msg ()
8790 else :
88- print file , badline , `line`
91+ if filename_only : print file
92+ else : print file , badline , `line`
8993 return
9094
9195 if verbose :
You can’t perform that action at this time.
0 commit comments