Skip to content

Commit 18a9ced

Browse files
committed
Support for -g in Session show_option and show_options.
1 parent ae1f47c commit 18a9ced

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

CHANGES

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ Here you can find the recent changes to tmuxp.
66
0.1-dev
77
-------
88

9+
2013-11-21
10+
''''''''''
11+
12+
- [internal] :meth:`Session.show_options`, :meth:`Session.show_option` now
13+
accept ``g`` to pass in ``-g``.
14+
915
2013-11-20
1016
''''''''''
1117

tmuxp/session.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -331,23 +331,31 @@ def set_option(self, option, value):
331331
proc.stderr = proc.stderr[0]
332332
raise ValueError('tmux set-option stderr: %s' % proc.stderr)
333333

334-
def show_options(self, option=None):
334+
def show_options(self, option=None, g=False):
335335
"""Return a dict of options for the window.
336336
337337
For familiarity with tmux, the option ``option`` param forwards to pick
338338
a single option, forwarding to :meth:`Session.show_option`.
339339
340340
:param option: optional. show a single option.
341341
:type option: string
342+
:param g: Pass ``-g`` flag for global variable
343+
:type g: bool
342344
:rtype: :py:obj:`dict`
343345
344346
"""
345347

348+
tmux_args = tuple()
349+
350+
if g:
351+
tmux_args += ('-g',)
352+
346353
if option:
347-
return self.show_option(option)
354+
return self.show_option(option, g=g)
348355
else:
356+
tmux_args += ('show-options',)
349357
session_options = self.tmux(
350-
'show-options'
358+
*tmux_args
351359
).stdout
352360

353361
session_options = [tuple(item.split(' ')) for item in session_options]
@@ -360,7 +368,7 @@ def show_options(self, option=None):
360368

361369
return session_options
362370

363-
def show_option(self, option):
371+
def show_option(self, option, g=False):
364372
"""Return a list of options for the window.
365373
366374
:todo: test and return True/False for on/off string
@@ -371,8 +379,13 @@ def show_option(self, option):
371379
372380
"""
373381

382+
tmux_args = tuple()
383+
384+
if g:
385+
tmux_args += ('-g',)
386+
374387
window_option = self.tmux(
375-
'show-options', option
388+
'show-options', option, *tmux_args
376389
).stdout
377390
window_option = [tuple(item.split(' ')) for item in window_option][0]
378391

0 commit comments

Comments
 (0)