From 6eff1d29c4ddd16ddf374ed9c5557b8f574a8966 Mon Sep 17 00:00:00 2001 From: Esa Kataja Date: Thu, 13 Mar 2025 13:58:07 +0200 Subject: [PATCH] Add loguru remove pydantic --- src/main.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/main.py diff --git a/src/main.py b/src/main.py new file mode 100644 index 0000000..aa7d575 --- /dev/null +++ b/src/main.py @@ -0,0 +1,22 @@ +import click +from pathlib import Path + +from json_parser import parse_json +from xml_parser import get_xml_data, add_connection, write_xml_data + + +@click.command +@click.option('-j', '--json', type=Path, required=True) +@click.option('-x', '--xml', type=Path, required=True) +@click.option('-n', '--name', type=str, required=True) +@click.option('-d', '--description', type=str, required=True) +@click.option('-p', '--pretty', is_flag=True, default=False, help='Enable pretty output') +def main(json: Path, xml: Path, name: str, description: str, pretty: bool): + xml_data = get_xml_data(xml) + field_names = parse_json(json) + root = add_connection(xml_data, name, field_names, description=description) + write_xml_data(root, xml, pretty=pretty) + + +if __name__ == "__main__": + main() \ No newline at end of file