Crates.io | semver-explain |
lib.rs | semver-explain |
version | 0.2.3 |
source | src |
created_at | 2021-11-17 12:19:24.081255 |
updated_at | 2024-01-26 21:36:52.454681 |
description | CLI tool to understand SemVer requirements by converting them to less-than, greater-than and/or equal-to form. |
homepage | |
repository | https://github.com/alilleybrinker/semver-explain |
max_upload_size | |
id | 483313 |
size | 15,194 |
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.
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>"
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
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.