linux-tools/main.py

32 lines
723 B
Python
Raw Normal View History

2019-12-14 04:26:02 +01:00
from CommandRunner import CommandRunnerDebug as Runner
2019-12-14 04:11:32 +01:00
import importlib
import os
print("Loading modules")
modules = {}
for folder in os.listdir("./modules"):
try:
curr_module = importlib.import_module('.' + folder, package="modules")
modules[folder] = curr_module.get_module()
except AttributeError:
pass
print("Modules loaded successfully.\n")
2019-12-14 04:11:32 +01:00
print("Available Modules:")
for mod in modules.keys():
print(mod)
2019-12-14 04:26:02 +01:00
print()
2019-12-14 04:11:32 +01:00
while True:
chosen_module = input("Please specify your module: ")
if chosen_module in modules.keys():
break
else:
print("Module was not found.")
2019-12-14 04:11:32 +01:00
print("\nChosen Module to run: " + chosen_module)
2019-12-14 04:11:32 +01:00
Runner().run(modules[chosen_module])
2019-12-14 04:11:32 +01:00