Files
log_analysis/services/console_client/console_client.py
T

41 lines
1.0 KiB
Python

from services.console_client.commands import *
def CreateCommandManager():
manager = CommandManager()
manager.addCommand(GetPipes())
manager.addCommand(GetPipelines())
manager.addCommand(CreatePipeline())
manager.addCommand(RunPipeline())
return manager
def PrintHelp(command_manager):
for index, command in enumerate(command_manager.commands):
print(str(index) + ". " + command.name)
def main():
command_manager = CreateCommandManager()
parameters = {
"host": "localhost",
"port": 8081
}
while True:
PrintHelp(command_manager)
command_name = str(input("> "))
if command_name in ["q", "quit", "exit"]:
break
if not command_manager.hasCommand(command_name):
print("there is no command with such name")
continue
command = command_manager.getCommand(command_name)
command.do(parameters)
print()
if __name__ == "__main__":
main()