Browse code

make bash8 take a -v flag

this ensures that we actually know we are processing all the files
we believe we are.

Change-Id: I8e99b5f9dc987c946586475f374f7040ca63a478

Sean Dague authored on 2014/02/24 10:41:07
Showing 2 changed files
... ...
@@ -26,4 +26,4 @@ fi
26 26
 
27 27
 echo "Running bash8..."
28 28
 
29
-./tools/bash8.py $FILES
29
+./tools/bash8.py -v $FILES
... ...
@@ -110,11 +110,13 @@ def end_of_multiline(line, token):
110 110
     return False
111 111
 
112 112
 
113
-def check_files(files):
113
+def check_files(files, verbose):
114 114
     in_multiline = False
115 115
     logical_line = ""
116 116
     token = False
117 117
     for line in fileinput.input(files):
118
+        if verbose and fileinput.isfirstline():
119
+            print "Running bash8 on %s" % fileinput.filename()
118 120
         # NOTE(sdague): multiline processing of heredocs is interesting
119 121
         if not in_multiline:
120 122
             logical_line = line
... ...
@@ -141,13 +143,14 @@ def get_options():
141 141
     parser.add_argument('files', metavar='file', nargs='+',
142 142
                         help='files to scan for errors')
143 143
     parser.add_argument('-i', '--ignore', help='Rules to ignore')
144
+    parser.add_argument('-v', '--verbose', action='store_true', default=False)
144 145
     return parser.parse_args()
145 146
 
146 147
 
147 148
 def main():
148 149
     opts = get_options()
149 150
     register_ignores(opts.ignore)
150
-    check_files(opts.files)
151
+    check_files(opts.files, opts.verbose)
151 152
 
152 153
     if ERRORS > 0:
153 154
         print("%d bash8 error(s) found" % ERRORS)