def show_window_option(self, option, g=False):
"""Return a list of options for the window.
todo: test and return True/False for on/off string
:param option: option to return.
:type option: str
:param g: Pass ``-g`` flag, global.
:type g: bool
:rtype: str, int
:raises: :exc:`exc.OptionError`, :exc:`exc.UnknownOption`,
:exc:`exc.InvalidOption`, :exc:`exc.AmbiguousOption`
"""
tmux_args = tuple()
if g:
tmux_args += ('-g',)
tmux_args += (option,)
cmd = self.cmd(
'show-window-options', *tmux_args
)
if len(cmd.stderr):
handle_option_error(cmd.stderr[0])
if not len(cmd.stdout):
return None
option = [shlex.split(item) for item in cmd.stdout][0]
if option[1].isdigit():
option = (option[0], int(option[1]))
return option[1]
评论列表
文章目录