File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -140,11 +140,25 @@ def panes(self) -> QueryList["Pane"]:
140140 # Command
141141 #
142142 def cmd (self , cmd : str , * args : t .Any ) -> tmux_cmd :
143- """Execute tmux subcommand against target session. See :meth:`server.cmd`.
143+ """Execute tmux subcommand within session context.
144+
145+ Automatically adds ``-t`` for object's session ID to the command. Pass ``-t``
146+ in args to override.
147+
148+ Examples
149+ --------
150+ >>> session.cmd('new-window', '-P').stdout[0]
151+ 'libtmux...:....0'
152+
153+ From raw output to an enriched `Window` object:
154+
155+ >>> Window.from_window_id(window_id=session.cmd(
156+ ... 'new-window', '-P', '-F#{window_id}').stdout[0], server=session.server)
157+ Window(@... ...:..., Session($1 libtmux_...))
144158
145159 Returns
146160 -------
147- :class :`server.cmd`
161+ :meth :`server.cmd`
148162
149163 Notes
150164 -----
You can’t perform that action at this time.
0 commit comments