shithub: pokered

Download patch

ref: 493b483490d141459f73be3db887fc0aeb2fdf7e
parent: 39a55822ce3fc7e5e73fc8f78973ec50284078dd
author: yenatch <yenatch@gmail.com>
date: Sun Dec 8 13:00:43 EST 2013

prequeue: say how many files are being preprocessed

--- a/prequeue.py
+++ b/prequeue.py
@@ -10,13 +10,14 @@
 
 import preprocessor
 
-def main():
-    processor = preprocessor.setup_processor()
+def preprocess_queue(filenames=sys.argv[1:]):
 
     stdin  = sys.stdin
     stdout = sys.stdout
 
-    for source in sys.argv[1:]:
+    processor = preprocessor.setup_processor()
+
+    for source in filenames:
         dest = os.path.splitext(source)[0] + '.tx'
         sys.stdin  = open(source, 'r')
         sys.stdout = open(dest, 'w')
@@ -27,6 +28,13 @@
     sys.stdin  = stdin
     sys.stdout = stdout
 
+def main():
+    filenames = list(set(sys.argv[1:]))
+    if filenames:
+        num_files = len(filenames)
+        s = '' if num_files == 1 else 's'
+        sys.stdout.write('Preprocessing {0} file{1}...\n'.format(num_files, s))
+	preprocess_queue(filenames)
 
 if __name__ == '__main__':
     main()