tmux_version (libtmux for Erlang v0.0.1)

View Source

Parse the output of tmux -V without invoking tmux.

Support covers tmux 3.3a through 3.8, including intermediate releases. The minimum-version check includes the patch letter; numeric feature comparisons use major/minor components. CI tests the endpoints of the supported range. Use tmux_server:version/1 for the daemon version observed by an endpoint.

Summary

Types

t()

Parsed numeric daemon version plus patch, tracking and original-output metadata.

Functions

Compare numeric major/minor components with a required floor. Patch letters do not promote an older minor release. Performs no I/O.

Parse bounded tmux -V output into numeric components and patch/tracking metadata. This is pure parsing, not a probe or compatibility qualification.

Reject a tmux release below the supported floor.

Types

t()

-type t() ::
          #{major := non_neg_integer(),
            minor := non_neg_integer(),
            patch := binary(),
            tracking := boolean(),
            raw := binary()}.

Parsed numeric daemon version plus patch, tracking and original-output metadata.

Functions

at_least/2

-spec at_least(t(), {non_neg_integer(), non_neg_integer()}) -> boolean().

Compare numeric major/minor components with a required floor. Patch letters do not promote an older minor release. Performs no I/O.

parse/1

-spec parse(binary()) -> {ok, t()} | {error, {invalid_tmux_version, term()}}.

Parse bounded tmux -V output into numeric components and patch/tracking metadata. This is pure parsing, not a probe or compatibility qualification.

require(Raw)

-spec require(binary()) ->
                 {ok, t()} | {error, {invalid_tmux_version | unsupported_tmux_version, term()}}.

Reject a tmux release below the supported floor.

1> {ok, Version} = tmux_version:require(<<"tmux 3.3a">>), ok.
ok
2> tmux_version:at_least(Version, {3, 4}).
false