mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2025-10-08 14:54:36 +00:00
hmm will it work
This commit is contained in:
parent
ba181d3838
commit
614958825d
1 changed files with 25 additions and 26 deletions
|
|
@ -52,12 +52,13 @@ def update_plugin_json(plugin_info, category):
|
||||||
file.truncate()
|
file.truncate()
|
||||||
|
|
||||||
|
|
||||||
def extract_plugman(plugins: str) -> dict:
|
def extract_plugman(plugins):
|
||||||
for plugin in plugins:
|
for plugin in plugins:
|
||||||
if "plugins/" in plugin:
|
if "plugins/" in plugin:
|
||||||
# Split the path and get the part after 'plugins/'
|
# Split the path and get the part after 'plugins/'
|
||||||
parts = plugin.split("plugins/")[1].split("/")
|
parts = plugin.split("plugins/")[1].split("/")
|
||||||
category = parts[0] # First part after plugins/
|
category = parts[0] # First part after plugins/
|
||||||
|
|
||||||
with open(plugin, "r") as f:
|
with open(plugin, "r") as f:
|
||||||
tree = ast.parse(f.read())
|
tree = ast.parse(f.read())
|
||||||
|
|
||||||
|
|
@ -77,8 +78,7 @@ def extract_plugman(plugins: str) -> dict:
|
||||||
result = {}
|
result = {}
|
||||||
for kw in node.value.keywords:
|
for kw in node.value.keywords:
|
||||||
result[kw.arg] = ast.literal_eval(kw.value)
|
result[kw.arg] = ast.literal_eval(kw.value)
|
||||||
return result, category
|
update_plugin_json(result, category=category)
|
||||||
|
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Variable plugman not found in the file or has unsupported format."
|
"Variable plugman not found in the file or has unsupported format."
|
||||||
)
|
)
|
||||||
|
|
@ -86,5 +86,4 @@ def extract_plugman(plugins: str) -> dict:
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
plugins = sys.argv
|
plugins = sys.argv
|
||||||
print(plugins) # Debugging (╯°□°)╯
|
extract_plugman(plugins)
|
||||||
update_plugin_json(*extract_plugman(plugins))
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue