From 12b7673b6e3b7cefc86ced8e48576653f845b266 Mon Sep 17 00:00:00 2001 From: Chris Diesch Date: Fri, 28 Mar 2025 13:39:34 -0600 Subject: [PATCH] Work on render templates.py added argument for variable file --- requirements.txt | 3 ++- scripts/render_templates.py | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 96ede90..03d7fbe 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ flask==3.1.0 flask-restx==1.3.0 pyopenssl==25.0.0 -werkzeug==3.1.3 \ No newline at end of file +werkzeug==3.1.3 +jinja2==3.1.6 diff --git a/scripts/render_templates.py b/scripts/render_templates.py index 47db22b..7a758be 100644 --- a/scripts/render_templates.py +++ b/scripts/render_templates.py @@ -21,6 +21,8 @@ if __name__ == '__main__': add_help=True) parser.add_argument('template_path', help='The path to the template to render.') + parser.add_argument('var_file_path', + help='The path to the file containing the variables to use for rendering the tempalte(s).') parser.add_argument('out_path', help='The path to write the rendered template.') parser.add_argument('-k', @@ -34,3 +36,13 @@ if __name__ == '__main__': action='store_true', help='If set the previous template will be overwritten.') + args = parser.parse_args() + + if not os.path.exists(args.template_path): + print(f'The given template path {args.template_path} does not exist.') + exit(1) + + if not os.path.exists(args.var_file_path): + print(f'The given template path {args.var_file_path} does not exist.') + exit(1) +