# Examples

Source: https://libtmux.org/en/ts/latest/examples/

> Programs for sending input, capturing output, and building workspaces.

Use these programs to send input, capture output, and build a workspace.
Each example page includes its source and test coverage. Check those details
before adapting an excerpt into a standalone program.

<a id="what-verified-means-per-port"></a>

## Source and verification

Port repositories use the following checks for their source examples. This site
reads or copies those examples; a successful site build alone does not execute
them:

[`scripts/check-doc-runnable.ts`](<https://github.com/libtmux/libtmux-ts/blob/f8ca14551254f81800faedc8bee9151565044ef1/scripts/check-doc-runnable.ts>) checks that a block tagged with its
example source matches that file line for line. The integration suite
executes the source program.

See [Testing with libtmux](https://libtmux.org/en/ts/latest/guides/testing-with-libtmux/) for the fixture
each of those test suites runs against, and each example page for the
exact file a given snippet was quoted from.

- [Attach and send keys](https://libtmux.org/en/ts/latest/examples/attach-and-send-keys/): Find a session, send a command, and read its output.
- [Capture pane output](https://libtmux.org/en/ts/latest/examples/capture-pane-output/): Read a pane's screen and wait for output to appear.
- [Build a workspace from a file](https://libtmux.org/en/ts/latest/examples/workspace-from-file/): Create a session, windows, and panes from configuration.
