#
# Copyright (C) 2019-Present A-Team Digital Solutions
#

class TerminalManager:
    def __init__(self, terminal):
        self.terminal = terminal
        self.ssh_connected = False
        self.remote_cfg = None
        self.remote_user = None
        self.remote_host = None
        self.remote_port = 22
        self.remote_path = None
    def run(self, command):
        print(f"SENDING : {command} ...")
        self.terminal.feed_child(
            (command + "\n").encode("utf-8")
        )
    def run_project(self, project, command):
        if self.ssh_connected and self.remote_path:
            cwd = self.remote_path
        else:
            cwd = project.rom_path
        self.run(
            f"cd {cwd}\n{command}"
        )
