Skip to content

pane_read

Asynchronously read output from a pane using the selected source and format options.

Read captured output from a pane.

Parameters:

Name Type Description Default
pane_id str

Target pane identifier.

required
source ReadSource

Output source, such as "recent" or "visible".

'recent'
lines int | None

Maximum number of lines to return, or None for no limit.

80
strip_ansi bool

Remove ANSI escape sequences when true.

True
format ReadFormat | None

Optional response format, "text" or "ansi".

None

Returns:

Type Description
PaneReadResponse

A typed pane read response containing the requested output.

Example
client = AsyncHerdrClient()
result = await client.pane_read("build", source="recent", lines=20)
print(result["text"])
Source code in src/herdr_client/async_client/client.py
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
async def pane_read(
    self,
    pane_id: str,
    source: ReadSource = "recent",
    lines: int | None = 80,
    strip_ansi: bool = True,
    format: ReadFormat | None = None,
) -> PaneReadResponse:
    """Read captured output from a pane.

    Args:
        pane_id: Target pane identifier.
        source: Output source, such as ``"recent"`` or ``"visible"``.
        lines: Maximum number of lines to return, or ``None`` for no limit.
        strip_ansi: Remove ANSI escape sequences when true.
        format: Optional response format, ``"text"`` or ``"ansi"``.

    Returns:
        A typed pane read response containing the requested output.

    Example:
        ```python
        client = AsyncHerdrClient()
        result = await client.pane_read("build", source="recent", lines=20)
        print(result["text"])
        ```
    """
    params: PaneReadParams = {
        "pane_id": pane_id,
        "source": source,
        "strip_ansi": strip_ansi,
    }
    if lines is not None:
        params["lines"] = lines
    if format is not None:
        params["format"] = format
    return await self.request("pane.read", params)