# LibTmux.read_formats

- **Module:** LibTmux
- **Package:** LibTmux
- **Language:** Julia
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-julia/blob/f3da513be1225d36d5854cd8db5972c01857578e/src/formats.jl#L115
- **Page:** https://libtmux.org/en/julia/latest/reference/libtmux-read_formats/

```
read_formats(
    connection::LibTmux.ControlConnection,
    target,
    fields::AbstractVector{<:LibTmux.FormatField};
    kwargs...
)

read_formats(
    connection::LibTmux.ControlConnection,
    target,
    fields::LibTmux.FormatField...;
    kwargs...
)

read_formats(
    server::LibTmux.Server,
    target,
    fields::AbstractVector{<:LibTmux.FormatField};
    kwargs...
)

read_formats(server::LibTmux.Server, target, fields::LibTmux.FormatField...; kwargs...)
```

## Methods

### `read_formats` (overload 1)

```julia
read_formats(
    connection::LibTmux.ControlConnection,
    target,
    fields::AbstractVector{<:LibTmux.FormatField};
    kwargs...
)
```

[Source](https://github.com/libtmux/libtmux-julia/blob/f3da513be1225d36d5854cd8db5972c01857578e/src/control_formats.jl#L57).

### `read_formats` (overload 2)

```julia
read_formats(
    connection::LibTmux.ControlConnection,
    target,
    fields::LibTmux.FormatField...;
    kwargs...
)
```

[Source](https://github.com/libtmux/libtmux-julia/blob/f3da513be1225d36d5854cd8db5972c01857578e/src/control_formats.jl#L55).

Read typed fields over a pinned control connection, with the target contexts and empty-value semantics of the subprocess method. Names outside the snapshot catalog remain valid. The escaped row grammar preserves tabs, newlines and guard-looking text without admitting arbitrary command output.

```julia
read_formats(connection::ControlConnection, target, fields::FormatField...; kwargs...)
read_formats(connection::ControlConnection, target, fields::AbstractVector{<:FormatField}; kwargs...)
```



The connection enforces its generation and never falls back to a subprocess. `strict=false` does not weaken this identity contract. `FormatValueError.result` retains the actual `ControlResult`. `max_output_bytes` bounds the encoded reply, including row prefix and escapes; the connection's frame limit also applies.

### `read_formats` (overload 3)

```julia
read_formats(
    server::LibTmux.Server,
    target,
    fields::AbstractVector{<:LibTmux.FormatField};
    kwargs...
)
```

[Source](https://github.com/libtmux/libtmux-julia/blob/f3da513be1225d36d5854cd8db5972c01857578e/src/formats.jl#L142).

### `read_formats(server::LibTmux.Server, target, fields::LibTmux.FormatField...; kwargs...)`

[Source](https://github.com/libtmux/libtmux-julia/blob/f3da513be1225d36d5854cd8db5972c01857578e/src/formats.jl#L140).

Read 1–256 fields with the lossless row codec, preserving field order and duplicates. Tabs, newlines, backslashes and Unicode remain literal values. Return `FormatObservation` values; empty expansions remain unverified. Nonempty invalid numeric or Boolean values raise `FormatValueError`.

```julia
read_formats(server, target, fields::FormatField...; kwargs...)
read_formats(server, target, fields::AbstractVector{<:FormatField}; kwargs...)
```



The target is mandatory. `PaneRef` selects the physical pane. `SessionRef` selects its active window and pane; `WindowRef` selects its active pane and tmux chooses a linked-session context. Use a session target for contextual session fields; a physical window has no unique session. Client references are not supported by this API. Identity checks are best effort; `strict=true` refuses execution. Deadline and cancellation options follow `new_session`.

These descriptors use names from the snapshot catalog without limiting callers to that catalog:

```julia
read_formats(server, pane_ref,
             FormatField("pane_width", Int), FormatField("pane_active", Bool),
             FormatField("version"))
```

## Parameters

- `connection` (`LibTmux.ControlConnection`) (for `read_formats(connection, target, fields, kwargs) [overload 1]`; `read_formats(connection, target, fields, kwargs) [overload 2]`)
- `target` (`Any`)
- `fields` (`Base.AbstractVector{<:LibTmux.FormatField}`) (for `read_formats(connection, target, fields, kwargs) [overload 1]`; `read_formats(server, target, fields, kwargs) [overload 3]`)
- `kwargs`
- `fields` (`Vararg{LibTmux.FormatField}`) (for `read_formats(connection, target, fields, kwargs) [overload 2]`; `read_formats(server, target, fields, kwargs) [overload 4]`)
- `server` (`LibTmux.Server`) (for `read_formats(server, target, fields, kwargs) [overload 3]`; `read_formats(server, target, fields, kwargs) [overload 4]`)
