diff --git a/.gitignore b/.gitignore index 389ff30..b6ace70 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,4 @@ Temporary Items /venv/ /.ipynb_checkpoints/ /.idea/ +*.json diff --git a/parse.py b/parse.py index 6829046..ba315f1 100644 --- a/parse.py +++ b/parse.py @@ -58,11 +58,8 @@ def parse(input, output, json_format, **kwargs): schematic.pop("hierarchy", None) - if output: - json_file = open(output, 'w') - json.dump(schematic, json_file) - else: - print(schematic) + return schematic + if __name__ == "__main__": parser = argparse.ArgumentParser(description='Converts Altium .SchDoc files into json.') @@ -74,4 +71,10 @@ if __name__ == "__main__": help='Organize records into owner/child "hierarchy" or leave as a "flat" list.') args = parser.parse_args() - parse(**vars(args)) \ No newline at end of file + schematic = parse(**vars(args)) + + if args.output: + json_file = open(args.output, 'w') + json.dump(schematic, json_file) + else: + print(schematic) \ No newline at end of file diff --git a/setup.py b/setup.py index bc1301e..b041e21 100644 --- a/setup.py +++ b/setup.py @@ -12,5 +12,6 @@ setup( author='Aaron Goldstein', author_email='aaronmgoldstein@gmail.com', description='Converts Altium .SchDoc files into json', - long_description=long_description + long_description=long_description, + long_description_content_type="text/markdown" )