commit 3021a31f430db72f605090adde91cd831395a8f6
parent fa93c9fd1e67feaf5e3b9863246ac42a8a3915cc
Author: Matthias Balk <mbalk@mbalk.de>
Date: Tue, 9 Feb 2021 20:53:27 +0100
Flag `-a` ignores configured date range and prints all events
Diffstat:
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/ya3 b/src/ya3
@@ -25,20 +25,27 @@ from argparse import ArgumentParser
import commands
import config
+import utils
+parser = ArgumentParser(description='''
+ya3 -- yet another appointment application, version {ver}'''.format(
+ ver=utils.get_ya3_version()))
-parser = ArgumentParser()
parser.add_argument('command',
choices=['create', 'add', 'print'],
help='create|add, print')
parser.add_argument('-f', '--filename', required=False,
- help='optional filename for command "print"')
+ help='Optional filename for command "print". Implies -a.')
+parser.add_argument('-a', '--all', required=False, action='store_true',
+ help='When used with command "print" all events are ' \
+ 'printed, configured date range is ignored.')
args = parser.parse_args()
if args.command == 'create' or args.command == 'add':
commands.create_event()
elif args.command == 'print':
if args.filename == None:
- commands.print_events(glob.glob(os.path.join(config.CAL_DIR, '*.ics')))
+ commands.print_events(glob.glob(os.path.join(config.CAL_DIR, '*.ics')),
+ ignore_configured_range=args.all)
else:
commands.print_events([args.filename], ignore_configured_range=True)