From da87e2cc84263245688246c8ba4dec40d7cb7934 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Sun, 7 Feb 2016 14:15:54 -0500 Subject: updated main() Added two mutually exclusive switches: --schedule --speakers If --schedule switch is used, the lps_gen inteprets that the template and the MD file corresponding to LP schedule. If --speakers switch is used, the lps_gen inteprets that the template and the MD file corresponding to LP speakers. Address issue #1. --- lps_gen.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lps_gen.py b/lps_gen.py index 52ef510..c5e81a7 100644 --- a/lps_gen.py +++ b/lps_gen.py @@ -278,6 +278,13 @@ def RenderHTML(lp_dict, template): def main(): parser = ArgumentParser() + + group = parser.add_mutually_exclusive_group() + group.add_argument("-s", "--schedule", action="store_true", + help="Generate LP schedule") + group.add_argument("-sp", "--speakers", action="store_true", + help="Generate LP speakers") + parser.add_argument("--version", action="version", version='lpschedule-generator version %s' % __version__, help="Show version number and exit.") @@ -291,7 +298,14 @@ def main(): lp_md_content = read_file(path.abspath(args.lp_md)) if path.exists(lp_template) and lp_md_content: - markdown = LPSMarkdown() + + if args.schedule: + markdown = LPSMarkdown() + elif args.speakers: + markdown = LPSpeakersMarkdown() + else: + parser.error('No action requested, add -s or -sp switch') + lp_dict = markdown(lp_md_content) lp_html = RenderHTML(lp_dict, lp_template) else: -- cgit v1.2.3