You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a new module is added or changed it would be nice to just run a GitHub Action that updates the module details section of the Pacu Wiki. Code is below on how this might be done.
import os
import importlib
from pathlib import Path
cat_set = set()
text_list = []
current_directory = os.getcwd()
for root, directories, files in os.walk(Path(__file__).parent/'pacu/modules'):
modules_directory_path = os.path.realpath(Path(__file__).parent/'pacu/modules')
specific_module_directory = os.path.realpath(root)
# Skip any directories inside module directories.
if os.path.dirname(specific_module_directory) != modules_directory_path:
continue
# Skip the root directory.
elif modules_directory_path == specific_module_directory:
continue
module_name = os.path.basename(root)
for file in files:
if file == 'main.py':
# Make sure the format is correct
module_path = str(Path('pacu/modules')/module_name/'main').replace('/', '.').replace('\\', '.')
# Import the help function from the module
module = __import__(module_path, globals(), locals(), ['module_info'], 0)
importlib.reload(module)
cat_set.add(module.module_info['category'])
text_list += [{"cat":module.module_info['category'],"text":f"### {module.module_info['name']}\n> **{module.module_info['one_liner']}**\n\n{module.module_info['description']}\n\n"}]
for cat in cat_set:
print(f"## {cat}")
for text in text_list:
if text["cat"] == cat:
print(text["text"])
This just prints out the MD formatted text with all the modules and descriptions to match the current wiki format.
The text was updated successfully, but these errors were encountered:
When a new module is added or changed it would be nice to just run a GitHub Action that updates the module details section of the Pacu Wiki. Code is below on how this might be done.
This just prints out the MD formatted text with all the modules and descriptions to match the current wiki format.
The text was updated successfully, but these errors were encountered: