def __init__(self, server = None, username = "", password = "", port = 22, accept_figerprint = False): super(FileCommander,self).__init__(server, username, password, port, accept_figerprint) self._local_bash = BashTerminal() self._syncroisation_cache = {} if server: self._remote_bash = SSHTerminal(server, username, password, port, accept_figerprint) else: self._remote_bash = BashTerminal()
class CreateFileBash(object): def __init__(self,directory, command): self.directory = directory self.command = command self.terminal = BashTerminal() def create_dir(self): home = self.terminal.home() self.terminal.chdir(home) if not self.terminal.exists(self.directory): self.terminal.mkdir(self.directory,True) self.terminal.chdir(self.directory) return self def create_file(self): self.create_dir() self.terminal.send_command(self.command) return self
def __init__(self,directory, command): self.directory = directory self.command = command self.terminal = BashTerminal()