def show_window_options(self, option=None, g=False):
"""Return a dict of options for the window.
For familiarity with tmux, the option ``option`` param forwards to pick
a single option, forwarding to :meth:`Window.show_window_option`.
:param option: optional. show a single option.
:type option: str
:param g: Pass ``-g`` flag for global variable
:type g: bool
:rtype: :py:obj:`dict`
"""
tmux_args = tuple()
if g:
tmux_args += ('-g',)
if option:
return self.show_window_option(option, g=g)
else:
tmux_args += ('show-window-options',)
cmd = self.cmd(
*tmux_args
).stdout
# The shlex.split function splits the args at spaces, while also
# retaining quoted sub-strings.
# shlex.split('this is "a test"') => ['this', 'is', 'a test']
cmd = [tuple(shlex.split(item)) for item in cmd]
window_options = dict(cmd)
for key, value in window_options.items():
if value.isdigit():
window_options[key] = int(value)
return window_options
评论列表
文章目录