On this page
libtmux.neo.get_output_format
- Module
- libtmux.neo
- Package
- libtmux
- Source
- src/libtmux/neo.py
-
Return field names and tmux format string filtered by scope and version.
Only emits tokens whose scope is reachable from *list_cmd* (per
SCOPES_BY_LIST_CMD) and whose minimum tmux version (perFIELD_VERSION) is at or below *tmux_version*. Runtime-only tokens (mouse_*,cursor_*, popups) are excluded from everylist-*template — they only resolve in event-time format contexts.Examples
>>> from libtmux.neo import get_output_format >>> fields, fmt = get_output_format("list-sessions", "3.6a") >>> 'session_id' in fields True >>> 'pane_id' in fields # active pane for the listed session True >>> 'client_name' in fields # upward not allowed False >>> 'server' in fields FalsePane scope picks up window and session tokens too:
>>> fields, _ = get_output_format("list-panes", "3.6a") >>> all(t in fields for t in ('pane_id', 'window_id', 'session_id')) Truelist-clientsadds fields for the attached client:>>> fields, _ = get_output_format("list-clients", "3.6a") >>> 'client_name' in fields True >>> 'pane_id' in fields True- Parameters
-
-
list_cmd ( str ) – The tmux list subcommand the format string is being built for. Determines which token scopes are reachable.
-
tmux_version ( str ) – The live tmux version. Used to gate post-3.2a tokens. Defaults to
"3.2a"(the project's minimum) for safe fallback when the caller can't yet detect the version.
-
- Returns
-
tuple[tuple[str, ...], str] A tuple of (field_names, tmux_format_string) restricted to tokens the given *list_cmd* and *tmux_version* can resolve.
0 declared, 0 inherited