Skip to content

Commit

Permalink
Put plugin-specific in a folder
Browse files Browse the repository at this point in the history
  • Loading branch information
dhinakg committed Jan 3, 2023
1 parent 824a07b commit cfe5e1d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion config_mgmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

def save_config(data: dict):
config_dir = Path(__file__).parent.absolute() / Path("Config")
plugin_dir = config_dir / Path("plugins")
plugin_dir.mkdir(exist_ok=True)

for plugin in data:
if plugin == "_version":
continue
data[plugin]["versions"].sort(key=lambda x: (x["date_committed"], x["date_authored"]), reverse=True)
json.dump(data[plugin] | {"_version": data["_version"]}, (config_dir / Path(f"{plugin}.json")).open("w"), sort_keys=True)
json.dump(data[plugin] | {"_version": data["_version"]}, (plugin_dir / Path(f"{plugin}.json")).open("w"), sort_keys=True)

latest = data.copy()
for plugin in latest:
Expand Down

0 comments on commit cfe5e1d

Please sign in to comment.