summaryrefslogtreecommitdiffstats
path: root/lps_gen.py
diff options
context:
space:
mode:
authorrsiddharth <rsd@gnu.org>2016-02-07 14:15:54 -0500
committerrsiddharth <rsd@gnu.org>2016-02-07 14:15:54 -0500
commitda87e2cc84263245688246c8ba4dec40d7cb7934 (patch)
tree9037c358fc0f9ae81dc002cd4c64be1547266f66 /lps_gen.py
parent700229847e2bb56e607a439d683da13bd84990b8 (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.
Diffstat (limited to 'lps_gen.py')
-rw-r--r--lps_gen.py16
1 files changed, 15 insertions, 1 deletions
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: