libtmux Reference MCP Search
On this page

libtmux.neo.fetch_objs

View as Markdown

Module
libtmux.neo
Package
libtmux
Source
src/libtmux/neo.py
fetch_objs ( server : Server , list_cmd : ListCmd , list_extra_args : ListExtraArgs = None , filter : str | None = None , # noqa: A002 ) OutputsRaw
function [source]
function [source]
fetch_objs

Fetch a listing of raw data from a tmux command.

Runs a tmux list command (e.g. list-sessions) with the format string from get_output_format and parses each line of output into a dict.

Examples

>>> from libtmux.neo import fetch_objs
>>> objs = fetch_objs(server=server, list_cmd="list-sessions")
>>> isinstance(objs, list)
True
>>> isinstance(objs[0], dict)
True
>>> 'session_id' in objs[0]
True
Parameters
  • server ( Server ) – The tmux server to query.

  • list_cmd ( ListCmd ) – The tmux list command to run, e.g. "list-sessions", "list-windows", or "list-panes".

  • list_extra_args ( ListExtraArgs ) – Extra arguments appended to the tmux command (e.g. ("-a",) for all windows/panes, or ["-t", session_id] to filter).

  • filter ( str | None ) – Filter expression evaluated by tmux (-f flag). tmux omits rows whose expanded expression is false before libtmux parses the result. tmux silently expands a malformed filter (unclosed #{...}, unknown format token) to empty, which is treated as false — every row is suppressed and no stderr is emitted. A bad filter is indistinguishable from "filter matched nothing"; verify the expression against the FORMATS section of tmux(1). See native-filtering for the typed wrappers that share this caveat. Warning: added 0.57

Returns

OutputsRaw A list of dicts, each mapping tmux format field names to their non-empty string values.

Raises

0 declared, 0 inherited

Esc

Type to search.