1
0
Fork 0
mirror of https://github.com/yavook/kiwi-scp.git synced 2024-11-22 21:03:00 +00:00
kiwi-scp/src/kiwi/runner.py
2020-08-10 16:27:52 +02:00

40 lines
768 B
Python

from .subcommands import *
###########
# CONSTANTS
SUBCOMMANDS = [
InitCommand,
ShowCommand,
LogsCommand
]
class Runner:
class __Runner:
__commands = []
def __init__(self):
for cmd in SUBCOMMANDS:
self.__commands.append(cmd())
def run(self, command_name):
for cmd in self.__commands:
if str(cmd) == command_name:
cmd.run()
return True
return False
__instance = None
def __init__(self):
if Runner.__instance is None:
Runner.__instance = Runner.__Runner()
def __getattr__(self, item):
return getattr(self.__instance, item)
if __name__ == 'kiwi.runner':
_ = Runner()