#semver #requirements #versioning #semantic #comparator #command-line-tool #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

#296 in Command line utilities

22 downloads per month

MIT license

10KB
124 lines

semver-explain

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.

Why?

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!

Examples

$ 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

Installation

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

USAGE:
    semver-explain <VERSION_REQ>

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

ARGS:
    <VERSION_REQ>    semantic versioning requirement to explain

License

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

Thanks

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

Dependencies

~4MB
~68K SLoC