Commit 37382f2a authored by PizZaKatZe's avatar PizZaKatZe

Add option to print the default URL

parent 8f8e1bde
......@@ -20,6 +20,7 @@
from argparse import ArgumentParser
from json import dumps
from sys import argv
from sys import exit as sysexit
from sys import stdout
from jht_flyergen.engine import fetch_data, render, generate_tex, process_sessions, read_data
......@@ -45,6 +46,8 @@ def parse_arguments(args):
help='path to output file; if omitted raw PDF data is written to stdout')
sources = parser.add_argument_group('data sources').add_mutually_exclusive_group(required=True)
sources.add_argument('-U', '--print-default-url', action='store_true',
help='print default URL and exit')
sources.add_argument('-u', '--url', nargs='?', const=DEFAULT_URL,
help='URL to fetch JSON data from; '
'if URL is omitted, a hard-coded default URL is used')
......@@ -62,6 +65,10 @@ def main():
"""
args = parse_arguments(argv[1:])
if args.print_default_url:
print(DEFAULT_URL)
sysexit()
sessions = None
if args.url:
sessions = fetch_data(args.url)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment