tmux_capability (libtmux for Erlang v0.0.1)
View SourceLook up source-derived native command declarations and feature minimums.
commands/1 and command/2 describe the exact source profiles in profiles/0.
Profiles cover every release in the supported tmux 3.3a–3.8 range. They do not
contact tmux, interpret its arguments or qualify another build.
Canonical command names are lookup keys; aliases remain metadata. A native
declaration does not mean this library provides a typed facade for it. Use
tmux_command:raw/2 for an explicit trusted command.
describe/1 reports selected native feature minimums. require/2 compares a
parsed version with one of those minimums; it does not perform I/O or dispatch
the command. Numeric minimum checks also accept uncatalogued and tracking
versions, preserving the distinction from exact parser discovery. They do not
establish runtime or CI qualification. Use tmux_server:version/1 to obtain the
version captured by a registered endpoint.
The generated reference records source profiles and parser declarations. Maintaining the catalogue needs a tmux source checkout; installed consumers use compiled data and OTP only.
Summary
Types
Native alias, flag declaration and positional bounds, with the exact source file, commit and SHA-256. none means no alias or an unbounded positional upper limit. Additional argument callbacks and runtime checks remain tmux's concern.
Selected native capabilities; these do not introduce new typed command options.
Source-sampled profiles, native commands, description and numeric minimum.
Functions
Look up one canonical native command in an exact source profile. Returns unknown_command for aliases or unknown names, unsupported_command when a known command is absent from that profile, and unsupported_command_catalogue for uncatalogued or tracking versions. Performs no I/O.
Return sorted canonical command names for an exact catalogued stable version. Tracking and uncatalogued versions return unsupported_command_catalogue. This is pure source discovery; it does not execute list-commands.
Return a selected native feature's source-derived minimum and sampled
profiles. Unknown features return unknown_capability. Performs no I/O;
require/2 applies the minimum to a parsed version.
List the exact source profile names in catalogue order. Performs no I/O.
Require a native feature's numeric major/minor floor without dispatching I/O. An older version returns unsupported_capability with capability and minimum. Patch letters and tracking markers do not promote an older minor version. Unknown features and malformed parsed versions return distinct errors.
Types
-type command_info() :: #{alias := binary() | none, argument_spec := binary(), min_args := non_neg_integer(), max_args := non_neg_integer() | none, source := #{file := binary(), commit := binary(), sha256 := binary()}}.
Native alias, flag declaration and positional bounds, with the exact source file, commit and SHA-256. none means no alias or an unbounded positional upper limit. Additional argument callbacks and runtime checks remain tmux's concern.
-type feature() :: native_list_filter | send_client_keys | key_list_format | layout_json.
Selected native capabilities; these do not introduce new typed command options.
-type feature_info() :: #{minimum := {non_neg_integer(), non_neg_integer()}, commands := [binary()], description := binary(), versions := [binary()]}.
Source-sampled profiles, native commands, description and numeric minimum.
Functions
-spec command(tmux_version:t(), binary()) -> {ok, command_info()} | {error, map()}.
Look up one canonical native command in an exact source profile. Returns unknown_command for aliases or unknown names, unsupported_command when a known command is absent from that profile, and unsupported_command_catalogue for uncatalogued or tracking versions. Performs no I/O.
1> {ok, V} = tmux_version:parse(<<"tmux 3.3a">>), ok.
ok
2> {ok, C} = tmux_capability:command(V, <<"send-keys">>), ok.
ok
3> maps:get(file, maps:get(source, C)).
<<"cmd-send-keys.c">>
-spec commands(tmux_version:t()) -> {ok, [binary()]} | {error, map()}.
Return sorted canonical command names for an exact catalogued stable version. Tracking and uncatalogued versions return unsupported_command_catalogue. This is pure source discovery; it does not execute list-commands.
-spec describe(feature()) -> {ok, feature_info()} | {error, map()}.
Return a selected native feature's source-derived minimum and sampled
profiles. Unknown features return unknown_capability. Performs no I/O;
require/2 applies the minimum to a parsed version.
-spec profiles() -> [binary()].
List the exact source profile names in catalogue order. Performs no I/O.
-spec require(tmux_version:t(), feature()) -> ok | {error, map()}.
Require a native feature's numeric major/minor floor without dispatching I/O. An older version returns unsupported_capability with capability and minimum. Patch letters and tracking markers do not promote an older minor version. Unknown features and malformed parsed versions return distinct errors.
1> {ok, V} = tmux_version:parse(<<"tmux 3.4">>), ok.
ok
2> tmux_capability:require(V, send_client_keys).
ok