# tmuxp.cli.search.extract_workspace_fields

- **Module:** tmuxp.cli.search
- **Package:** tmuxp
- **Language:** Python
- **Kind:** function
- **Source:** https://github.com/tmux-python/tmuxp/blob/153acdf6ff1268b14d3d03ed488f545a7123c8f1/src/tmuxp/cli/search.py#L534
- **Page:** https://libtmux.org/en/py/latest/workspace/reference/tmuxp-cli-search-extract_workspace_fields/

```
tmuxp.cli.search.extract_workspace_fields(filepath: pathlib.Path) -> WorkspaceFields
```

Extract searchable fields from a workspace file.

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

## Parameters

- `filepath` (pathlib.Path): Path to the workspace file.

## Returns

WorkspaceFields
    Dictionary of extracted fields.

## Example

```python
>>> 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()
```
