# HG changeset patch # User Daniel O'Connor # Date 1505133877 -34200 # Node ID 7fd3dc0516f82d376f8956a9f6c9e27adad0be30 # Parent db4951d2d303333234587a3f2911752e03c2b495 Do some option sanity checking. diff -r db4951d2d303 -r 7fd3dc0516f8 agl.py --- a/agl.py Mon Sep 11 22:09:37 2017 +0930 +++ b/agl.py Mon Sep 11 22:14:37 2017 +0930 @@ -44,6 +44,9 @@ if not args.update and not args.graph: parser.error('Nothing to do') + if args.days is not None and args.days < 0: + parser.error('days must be non-negative') + start = args.start if start is None: start = datetime.date.today() @@ -57,6 +60,9 @@ end = start + datetime.timedelta(days = 1) end = datetime.datetime(end.year, end.month, end.day) + if start >= end: + parser.error('Start must be before end') + dbh = sqlite3.connect(dbfn, detect_types = sqlite3.PARSE_DECLTYPES) cur = dbh.cursor() if args.update: