Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
:param target_pane: ``target_pane``, or ``-U``,``-D``, ``-L``, ``-R``.
:type target_pane: string
:rtype: :class:`Pane`
"""
if 'height' in kwargs:
proc = self.cmd('resize-pane', '-y%s' % int(kwargs['height']))
elif 'width' in kwargs:
proc = self.cmd('resize-pane', '-x%s' % int(kwargs['width']))
else:
proc = self.cmd('resize-pane', args[0])
if proc.stderr:
raise exc.LibTmuxException(proc.stderr)
self.server._update_panes()
return self
kill 'asdfasd'.
Returns
-------
:class:`Server`
Raises
------
:exc:`exc.BadSessionName`
"""
session_check_name(target_session)
proc = self.cmd('kill-session', '-t%s' % target_session)
if proc.stderr:
raise exc.LibTmuxException(proc.stderr)
return self
def get_window(self, session, window_name):
if isinstance(session, str):
# get actual session from session name
session = self.get_session(session)
if session is None:
return None
try:
return session.find_where({'window_name': window_name})
except LibTmuxException:
return None
if 'window_active' in window:
# for now window_active is a unicode
if window.get('window_active') == '1':
active_windows.append(Window(session=self, **window))
else:
continue
if len(active_windows) == int(1):
return active_windows[0]
else:
raise exc.LibTmuxException(
'multiple active windows found. %s' % active_windows
)
if len(self._windows) == int(0):
raise exc.LibTmuxException('No Windows')
class TmuxCommandNotFound(LibTmuxException):
"""Application binary for tmux not found."""
pass
class BadSessionName(LibTmuxException):
"""Disallowed session name for tmux (empty, contains periods or colons)."""
pass
class OptionError(LibTmuxException):
"""Root error for any error involving invalid, ambiguous or bad options."""
pass
class UnknownOption(OptionError):
"""Option unknown to tmux show-option(s) or show-window-option(s)."""
pass
class InvalidOption(OptionError):
"""Option invalid to tmux, introduced in tmux v2.4."""
----------
target_pane : str
'target_pane', '-U' ,'-D', '-L', '-R', or '-l'.
Return
------
:class:`Pane`
"""
if target_pane in ['-l', '-U', '-D', '-L', '-R']:
proc = self.cmd('select-pane', '-t%s' % self.id, target_pane)
else:
proc = self.cmd('select-pane', '-t%s' % target_pane)
if proc.stderr:
raise exc.LibTmuxException(proc.stderr)
return self.attached_pane
:type target_pane: string
:rtype: :class:`Pane`
"""
if target_pane in ['-l', '-U', '-D', '-L', '-R']:
proc = self.cmd(
'select-pane',
'-t%s' % self.get('window_id'),
target_pane
)
else:
proc = self.cmd('select-pane', '-t%s' % target_pane)
if proc.stderr:
raise exc.LibTmuxException(proc.stderr)
return self.attached_pane()