Пример #1
0
class Shell(CLInterface):
    """
    Interactive secure copy shell.
    """
    def __init__(self, pty, host, logger_interface, clone_shell=None): # XXX: import clone_shell
        assert issubclass(host, Host)
        assert pty

        self.host = type('RemoteSCPHost', (CacheMixin, host), { })(pty=pty, logger=logger_interface)
        self.host.fill_cache(pty)
        self.localhost = LocalHost(pty=pty, logger=logger_interface)
        self.localhost.host_context._chdir(os.getcwd())
        self.pty = pty
        self.root_handler = RootHandler(self)

        CLInterface.__init__(self, self.pty, RootHandler(self))

        # Caching for autocompletion (directory -> list of content.)
        self._cd_cache = { }

    @property
    def prompt(self):
        get_name = lambda p: os.path.split(p)[-1]

        return [
                    ('local:%s' % get_name(self.localhost.getcwd() or ''), 'yellow'),
                    (' ~ ', 'cyan'),
                    ('%s:' % self.host.slug, 'yellow'),
                    (get_name(self.host.getcwd() or ''), 'yellow'),
                    (' > ', 'cyan'),
                ]
Пример #2
0
    def __init__(self,
                 pty,
                 host,
                 logger_interface,
                 clone_shell=None):  # XXX: import clone_shell
        assert issubclass(host, Host)
        assert pty

        self.host = type('RemoteSCPHost', (CacheMixin, host),
                         {})(pty=pty, logger=logger_interface)
        self.host.fill_cache(pty)
        self.localhost = LocalHost(pty=pty, logger=logger_interface)
        self.localhost.host_context._chdir(os.getcwd())
        self.pty = pty
        self.root_handler = RootHandler(self)

        CLInterface.__init__(self, self.pty, RootHandler(self))

        # Caching for autocompletion (directory -> list of content.)
        self._cd_cache = {}
Пример #3
0
    def __init__(self, pty, host, logger_interface, clone_shell=None): # XXX: import clone_shell
        assert issubclass(host, Host)
        assert pty

        self.host = type('RemoteSCPHost', (CacheMixin, host), { })(pty=pty, logger=logger_interface)
        self.host.fill_cache(pty)
        self.localhost = LocalHost(pty=pty, logger=logger_interface)
        self.localhost.host_context._chdir(os.getcwd())
        self.pty = pty
        self.root_handler = RootHandler(self)

        CLInterface.__init__(self, self.pty, RootHandler(self))

        # Caching for autocompletion (directory -> list of content.)
        self._cd_cache = { }
Пример #4
0
class Shell(CLInterface):
    """
    Interactive secure copy shell.
    """
    def __init__(self,
                 pty,
                 host,
                 logger_interface,
                 clone_shell=None):  # XXX: import clone_shell
        assert issubclass(host, Host)
        assert pty

        self.host = type('RemoteSCPHost', (CacheMixin, host),
                         {})(pty=pty, logger=logger_interface)
        self.host.fill_cache(pty)
        self.localhost = LocalHost(pty=pty, logger=logger_interface)
        self.localhost.host_context._chdir(os.getcwd())
        self.pty = pty
        self.root_handler = RootHandler(self)

        CLInterface.__init__(self, self.pty, RootHandler(self))

        # Caching for autocompletion (directory -> list of content.)
        self._cd_cache = {}

    @property
    def prompt(self):
        get_name = lambda p: os.path.split(p)[-1]

        return [
            ('local:%s' % get_name(self.localhost.getcwd() or ''), 'yellow'),
            (' ~ ', 'cyan'),
            ('%s:' % self.host.slug, 'yellow'),
            (get_name(self.host.getcwd() or ''), 'yellow'),
            (' > ', 'cyan'),
        ]