semver-query is a utility for querying semantic version data.
The program accepts a list of line separated entries, for example:
For example, the convention when using git, is that every release is associated with a tag. The input can be generated using git tag --list. In this case, the output of the git command can be piped directly to semver-query:
Another alternative is using the Github api:
Imagine you are preparing an environment and you need the installed software to match certain version criteria. You can use semver-query to automate the process of selecting the version of software that match certain criteria.
Imagine you want to test your app with several versions of a library: "I want to make sure that my app works with the three latest minor versions for major version Y of library X". You can use semver-query from a CI environment to make sure you select the three latest minor versions of library X
The query supports the lua programming language syntax and can be written like an if statement condition.
major | number |
minor | number |
patch | number |
prerelease | string |
buildmetadata | string |
All the lua comparison operators are supported: <, >, <=, >=, ==, ~=
The supported logical operators are and and or.
- major == 2 and minor >= 7 and minor <= 9
- major <= 20 and minor > 0
- minor >= 29 and patch > 0
- minor == 29 and pre_release ~= 'alpha.0' and pre_release ~= 'alpha.1' and pre_release ~= 'alpha.2' and pre_release ~= 'alpha.3'
- major >= 17 and major <= 20 and patch > 1 and patch <= 3
cargo install semver-query.
For each release, binaries are published for the following platforms:
- x86_64-apple-darwin
- x86_64-unknown-linux-gnu
- aarch64-apple-darwin
- aarch64-unknown-linux-gnu
Note to Windows users: sorry but I was not able compile the project for the platforms (x86_64-pc-windows-msvc, aarch64-pc-windows-msvc). Help is welcome.
The download link can be found in the release page
the project can be built using cargo build -r, after cloning the repository.
- Sorting
- Limits
- Pattern matching
- Output delimiters