# Server.format(_:)

- **Module:** Server
- **Package:** libtmux-swift
- **Language:** Swift
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Sources/LibTmux/Formats.swift#L395
- **Page:** https://libtmux.org/en/swift/latest/reference/server-format(_-)/

```
Server.format(_:)(template: String) -> String?
```

Evaluates a tmux format against the server rather than any one object.

Reaches the fields that describe the server itself — `#{pid}`,
`#{version}`, `#{socket_path}` — and any format tmux resolves without a
target.

- Returns: what tmux printed, minus its trailing newline, or `nil` when
  no server is listening. An unknown field name is not an error to tmux
  and comes back as the empty string, the same as a field that is
  legitimately empty.

## Raises

- `TmuxError`
