File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -113,12 +113,25 @@ def session(self) -> "Session":
113113 """
114114
115115 def cmd (self , cmd : str , * args : t .Any ) -> tmux_cmd :
116- """Execute tmux subcommand against target pane. See also: :meth:`Server.cmd` .
116+ """Execute tmux subcommand within pane context .
117117
118- Send command to tmux with :attr:`pane_id` as ``target-pane``.
118+ Automatically adds ``-t`` for object's pane ID to the command. Pass ``-t``
119+ in args to override.
119120
120- Specifying ``('-t', 'custom-target')`` or ``('-tcustom_target')`` in
121- ``args`` will override using the object's ``pane_id`` as target.
121+ Examples
122+ --------
123+ >>> pane.cmd('split-window', '-P').stdout[0]
124+ 'libtmux...:...'
125+
126+ From raw output to an enriched `Pane` object:
127+
128+ >>> Pane.from_pane_id(pane_id=pane.cmd(
129+ ... 'split-window', '-P', '-F#{pane_id}').stdout[0], server=pane.server)
130+ Pane(%... Window(@... ...:..., Session($1 libtmux_...)))
131+
132+ Returns
133+ -------
134+ :meth:`server.cmd`
122135 """
123136 if not any ("-t" in str (x ) for x in args ):
124137 args = ("-t" , self .pane_id , * args )
You can’t perform that action at this time.
0 commit comments