Skip to content

Commit 541ad0c

Browse files
committed
working adding kwargs to tmux_cmd but breakin all the tests
1 parent 084290b commit 541ad0c

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

libtmux/common.py

+2
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ def __init__(self, *args, **kwargs):
174174

175175
cmd = [tmux_bin]
176176
cmd += args # add the command arguments to cmd
177+
# add kwargs, separated by spaces
178+
cmd += ['{} {}'.format(k,v) for k,v in kwargs.items()]
177179
cmd = [str(c) for c in cmd]
178180

179181
self.cmd = cmd

tests/test_common.py

+9
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,12 @@ def test_session_check_name(session_name, raises, exc_msg_regex):
168168
assert exc_info.match(exc_msg_regex)
169169
else:
170170
session_check_name(session_name)
171+
172+
def test_tmux_cmd_uses_args_and_kwargs():
173+
kwargs = {'-t':'nope'}
174+
cmd = tmux_cmd('show-environment', **kwargs)
175+
assert 'show-environment' in cmd.cmd
176+
# kwargs format should be correct
177+
assert '-t nope' in cmd.cmd
178+
# tmux error should be expected
179+
assert 'no such session: nope' in cmd.stderr

0 commit comments

Comments
 (0)