linux-tools/main.py

35 lines
908 B
Python
Raw Normal View History

from PyInquirer import prompt
2019-12-14 04:11:32 +01:00
import importlib
import os
def load_modules():
print("Loading modules")
loaded_modules = {}
for folder in os.listdir("./modules"):
try:
curr_module = importlib.import_module('.' + folder, package="modules")
loaded_modules[folder] = curr_module.get_module()
except AttributeError:
pass
print("Modules loaded successfully.\n")
return loaded_modules
2019-12-14 04:11:32 +01:00
def open_module_selection(module_names):
print("Available Modules:")
module_selection = [
{
'type': 'checkbox',
'message': 'Select modules',
'name': 'modules',
'choices': list(map(lambda x: {"name": x}, list(module_names)))
}
]
return prompt(module_selection)['modules']
2019-12-14 04:11:32 +01:00
modules = load_modules()
[modules[module].run() for module in open_module_selection(modules.keys())]