diff options
author | rsiddharth <rsd@gnu.org> | 2016-02-07 14:15:54 -0500 |
---|---|---|
committer | rsiddharth <rsd@gnu.org> | 2016-02-07 14:15:54 -0500 |
commit | da87e2cc84263245688246c8ba4dec40d7cb7934 (patch) | |
tree | 9037c358fc0f9ae81dc002cd4c64be1547266f66 | |
parent | 700229847e2bb56e607a439d683da13bd84990b8 (diff) |
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.
-rw-r--r-- | lps_gen.py | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -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: |