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
-
-
filepath(pathlib.Path ) # – Path to the workspace file.
-
- Returns
-
WorkspaceFields Dictionary of extracted fields.