Skip to content

Commit 8c297fc

Browse files
committed
chore(Session.cmd): Accept cmd as first positional argument
1 parent e4a47c2 commit 8c297fc

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/libtmux/session.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def panes(self) -> QueryList["Pane"]:
139139
#
140140
# Command
141141
#
142-
def cmd(self, *args: t.Any, **kwargs: t.Any) -> tmux_cmd:
142+
def cmd(self, cmd: str, *args: t.Any, **kwargs: t.Any) -> tmux_cmd:
143143
"""Execute tmux subcommand against target session. See :meth:`server.cmd`.
144144
145145
Returns
@@ -156,15 +156,14 @@ def cmd(self, *args: t.Any, **kwargs: t.Any) -> tmux_cmd:
156156
if not any("-t" in str(x) for x in args):
157157
# insert -t immediately after 1st arg, as per tmux format
158158
new_args: t.Tuple[str, ...] = ()
159-
new_args += (args[0],)
160159
assert isinstance(self.session_id, str)
161160
new_args += (
162161
"-t",
163162
self.session_id,
164163
)
165-
new_args += tuple(args[1:])
164+
new_args += args
166165
args = new_args
167-
return self.server.cmd(*args, **kwargs)
166+
return self.server.cmd(cmd, *args, **kwargs)
168167

169168
"""
170169
Commands (tmux-like)

0 commit comments

Comments
 (0)