--- a/incoming.py Wed Jul 13 16:54:30 2016 +0800
+++ b/incoming.py Wed Jul 13 18:25:43 2016 +0800
from __future__ import absolute_import
+from argparse import ArgumentParser, FileType
from datetime import datetime
from urlparse import urlparse
+ parser = ArgumentParser()
+ 'file', type=FileType('r'), nargs='?', default=sys.stdin,
+ help='file to read from (if - or not specified, read from stdin)')
+ '-d', '--debug', action='store_true',
+ help='enable debugging output')
+ args = parser.parse_args()
database.init(rel('database.sqlite'))
database.create_tables([Project, Change, Check], safe=True)
- logger = logging.getLogger('peewee')
- logger.setLevel(logging.DEBUG)
- logger.addHandler(logging.StreamHandler())
- insert_check(list(fileinput.input()))
+ logger = logging.getLogger('peewee')
+ logger.setLevel(logging.DEBUG)
+ logger.addHandler(logging.StreamHandler())
+ insert_check(args.file)