mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2025-10-08 14:54:36 +00:00
[ci] auto-format
This commit is contained in:
parent
3d69cc4d54
commit
1f5348f51f
2 changed files with 12 additions and 10 deletions
|
|
@ -2,11 +2,12 @@ import ast
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def update_plugin_json(plugin_info, category):
|
def update_plugin_json(plugin_info, category):
|
||||||
name = next(iter(plugin_info))
|
name = next(iter(plugin_info))
|
||||||
details = plugin_info[name]
|
details = plugin_info[name]
|
||||||
|
|
||||||
with open(f"{category}.json",'r+') as file:
|
with open(f"{category}.json", 'r+') as file:
|
||||||
data = json.load(file)
|
data = json.load(file)
|
||||||
try:
|
try:
|
||||||
# Check if plugin is already in the json
|
# Check if plugin is already in the json
|
||||||
|
|
@ -21,10 +22,11 @@ def update_plugin_json(plugin_info, category):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
data["plugins"][name] = details
|
data["plugins"][name] = details
|
||||||
file.seek(0)
|
file.seek(0)
|
||||||
json.dump(data, file, indent = 2, ensure_ascii=False)
|
json.dump(data, file, indent=2, ensure_ascii=False)
|
||||||
# Ensure old content is removed
|
# Ensure old content is removed
|
||||||
file.truncate()
|
file.truncate()
|
||||||
|
|
||||||
|
|
||||||
def extract_ba_plugman(plugins: str) -> dict | list:
|
def extract_ba_plugman(plugins: str) -> dict | list:
|
||||||
for plugin in plugins:
|
for plugin in plugins:
|
||||||
if "plugins/" in plugin:
|
if "plugins/" in plugin:
|
||||||
|
|
@ -46,7 +48,7 @@ def extract_ba_plugman(plugins: str) -> dict | list:
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"Variable ba_plugman not found.")
|
raise ValueError(f"Variable ba_plugman not found.")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
plugins = sys.argv
|
plugins = sys.argv
|
||||||
extract_ba_plugman(plugins)
|
extract_ba_plugman(plugins)
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue