Workspace ManagerstableAPI Reference

Choose documentation 3

stable

Current version

stable
English

Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

tmuxp.cli.search.extract_workspace_fields

tmuxp.cli.search.extract_workspace_fields ( filepath: pathlib.Path, ) → WorkspaceFields

Extract searchable fields from a workspace file.

Description#

Parses the workspace configuration and extracts name, path, session_name, window names, and pane commands for searching.

Examples#

>>> import tempfile
>>> import pathlib
>>> content = '''
... session_name: my-project
... windows:
... - window_name: editor
... panes:
... - vim
... - shell_command: git status
... - window_name: shell
... '''
>>> with tempfile.NamedTemporaryFile(
... suffix='.yaml', delete=False, mode='w'
... ) as f:
... _ = f.write(content)
... temp_path = pathlib.Path(f.name)
>>> fields = extract_workspace_fields(temp_path)
>>> fields["session_name"]
'my-project'
>>> sorted(fields["windows"])
['editor', 'shell']
>>> 'vim' in fields["panes"]
True
>>> temp_path.unlink()
Parameters
Returns

WorkspaceFields Dictionary of extracted fields.

Esc

Type to search.

Reference preview Open reference