#semver #requirements #comparator #versioning #cli-tool #semantic #forms

app semver-explain

CLI tool to understand SemVer requirements by converting them to less-than, greater-than and/or equal-to form

5 releases

0.2.3 Jan 26, 2024
0.2.2 Jan 4, 2022
0.2.1 Nov 19, 2021
0.2.0 Nov 19, 2021
0.1.0 Nov 17, 2021

#276 in Command line utilities

MIT license

124 lines


Convert SemVer requirements to their most-obvious equivalents.

semver-explain is a CLI tool to explain Semantic Versioning requirements by converting them to a form with only less-than, greater-than and/or equal-to comparators, where the major, minor, and patch versions are all specified.

The exact interpretation of SemVer requirements' meaning comes from Cargo. In particular, it does not handle hyphen ranges or x-ranges from the node-semver library for JavaScript.


It's easy to forget the exact meaning of SemVer comparators like ~, ^, and *. Rather than looking up documentation to confirm what's meant by a requirement, you can plug it into semver-explain and get a set of more-obvious equivalent requirements!


$ semver-explain "^1.4.0"
>=1.4.0, <2.0.0
$ semver-explain "~0.5.3"
>=0.5.3, <0.6.0
$ semver-explain "5.6.*"
>=5.6.0, <5.7.0


semver-explain is written in Rust, so you'll need to install Rust first.

# To install from Crates.io
$ cargo install semver-explain
# To install from source (after cloning or downloading)
$ cargo install --path "<path to download>"

How to Use

Just give it a SemVer requirement as a string! The CLI is purposefully simple.

semver-explain 0.2.0

    semver-explain <VERSION_REQ>

    -h, --help       Prints help information
    -V, --version    Prints version information

    <VERSION_REQ>    semantic versioning requirement to explain


semver-explain is MIT licensed. The full license text can be found in LICENSE.md.


This tool uses the excellent Rust semver library, without which it would have been much more tedious to build.


~50K SLoC