fetch_obj
Fetch the single list-* row whose obj_key equals obj_id.
Source and package
- Qualified name
-
libtmux.neo .fetch _obj - Module
- libtmux.neo
- Package
- libtmux
- Source
- src/libtmux/neo.py
-
Description#
A listing enumerates winlinks, so a window linked into one session at two indexes matches twice.
_best_winlinkthen picks the row tmux itself would act on, rather than whichever sorted last.Examples#
>>> from libtmux.neo import fetch_obj>>> fetch_obj(... server=pane.server,... obj_key="pane_id",... obj_id=pane.pane_id,... list_cmd="list-panes",... list_extra_args=("-t", pane.pane_id),... )["pane_id"] == pane.pane_idTrueA pane that does not exist on a live server is a
TmuxObjectDoesNotExist, not a bare tmux error:>>> from libtmux import exc>>> try:... fetch_obj(... server=pane.server,... obj_key="pane_id",... obj_id="%99999",... list_cmd="list-panes",... list_extra_args=("-t", "%99999"),... )... except exc.TmuxObjectDoesNotExist as e:... print(e)Could not find pane_id=%99999 for list-panes ('-t', '%99999')- Parameters
-
-
obj_id(str) # – Value the identity field must equal, e.g."%3". -
list_extra_args(ListExtraArgs) # – Extra arguments appended verbatim to the tmux command, e.g.("-t", "%3")to scope the listing to one object's parent.
- Returns
-
OutputRaw The matching row, as a dict of tmux format fields.
- Raises
-
-
Tmux
Object – When the object does not exist -- whether tmux said so on stderr (Does Not Exist can't find pane: %99, for a-t-scoped listing) or the object simply never appeared in the rows. -
Lib
Tmux – For every other tmux failure, notably an unreachable server.Exception
-