fetch_objs
Fetch a listing of raw data from a tmux command.
Source and package
- Qualified name
-
libtmux.neo .fetch _objs - 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, ) Outputs
Raw -
Description#
Runs a tmux list command (e.g.
list-sessions) with the format string fromget_output_formatand 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
-
-
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 (-fflag). 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 oftmux(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
-
-
Lib
Tmux – If the tmux command writes to stderr.Exception
-