diff --git a/manage/update_manifest.py b/manage/update_manifest.py new file mode 100644 index 0000000..64585ab --- /dev/null +++ b/manage/update_manifest.py @@ -0,0 +1,27 @@ +"""Update the manifest file.""" +import sys +import json +import os + + +def update_manifest(): + """Update the manifest file.""" + version = "0.0.0" + for index, value in enumerate(sys.argv): + if value in ["--version", "-V"]: + version = sys.argv[index + 1] + + with open( + f"{os.getcwd()}/custom_components/stadtreinigung_hamburg/manifest.json" + ) as manifestfile: + manifest = json.load(manifestfile) + + manifest["version"] = version + + with open( + f"{os.getcwd()}/custom_components/stadtreinigung_hamburg/manifest.json", "w" + ) as manifestfile: + manifestfile.write(json.dumps(manifest, indent=4, sort_keys=True)) + + +update_manifest() \ No newline at end of file