Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

Edit this page on GitHub

These examples show how to complete a tmux task in each language. Use the tabs to select your port. Each page includes the source file and the checks run by that port’s test suite; see those details before adapting an excerpt into a standalone program.

Examples marked with file= are read from the port source during the build. Other blocks are copied excerpts. The source details identify which mechanism each block uses.

What “verified” means, per portLink to section

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:

PortMechanismWhat it checks
Pythonpytest testpaths includes README.md and src/libtmux>>> doctest blocks run against a real, isolated tmux session on every test run
TypeScriptscripts/check-doc-runnable.tsA block tagged <!-- runs: examples/foo.ts --> must appear, line for line, in that file, which the integration suite executes
Gogo generate ./tmux (internal/generate/docs)A <!-- docs:name --> region in README.md is rewritten from the matching // docs:name … // docs:end region in examples/; CI fails on drift
Rust#![doc = include_str!("../README.md")]The entire README is a doc comment, so cargo test --doc compiles and runs every fenced Rust block in it
Javadocs-tests (./gradlew :docs-tests:test)Every Java fence in READMEs and guides is compiled against the real artifacts, then run against real tmux via libtmux-junit5
.NETsync_snippets.py --check + ReadmeExampleTestsA <!-- snippet: Name --> region is quoted from a tested [Example] method; every csharp run block is additionally compiled and executed
C++tools/docs/check_readme.pyEach ```cpp block in README.md must appear verbatim as a #region in examples/05-readme.cpp, which CTest builds and runs
SwiftScripts/check_examples.pyEach ```swift block in README.md and product READMEs must appear in Examples/Sources/, which swift test --package-path Examples compiles through its public products

See Testing with libtmux for the fixture each of those test suites runs against, and each example page below for the exact file a given snippet was quoted from.

Esc

Type to search.