hmm will it work

This commit is contained in:
brostos 2025-07-23 22:43:27 +03:00 committed by GitHub
parent ba181d3838
commit 614958825d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -52,12 +52,13 @@ def update_plugin_json(plugin_info, category):
file.truncate()
def extract_plugman(plugins: str) -> dict:
def extract_plugman(plugins):
for plugin in plugins:
if "plugins/" in plugin:
# Split the path and get the part after 'plugins/'
parts = plugin.split("plugins/")[1].split("/")
category = parts[0] # First part after plugins/
with open(plugin, "r") as f:
tree = ast.parse(f.read())
@ -77,8 +78,7 @@ def extract_plugman(plugins: str) -> dict:
result = {}
for kw in node.value.keywords:
result[kw.arg] = ast.literal_eval(kw.value)
return result, category
update_plugin_json(result, category=category)
raise ValueError(
"Variable plugman not found in the file or has unsupported format."
)
@ -86,5 +86,4 @@ def extract_plugman(plugins: str) -> dict:
if __name__ == "__main__":
plugins = sys.argv
print(plugins) # Debugging (╯°□°)╯
update_plugin_json(*extract_plugman(plugins))
extract_plugman(plugins)