SemVer
SemVer is a command-line utility for working with Semantic Versions.
Install
Homebrew
brew install ffurrer2/tap/semver
Scoop
scoop bucket add ffurrer2 https://github.com/ffurrer2/scoop-bucket
scoop install semver
Usage
help
$ semver help
The semantic version utility
Usage:
semver [command]
Available Commands:
compare Compare semantic versions
filter Filter semantic versions
format Format and print semantic versions
help Help about any command
next Increment semantic versions
sort Sort semantic versions
validate Validate semantic versions
version Print version information
Flags:
-h, --help help for semver
Use "semver [command] --help" for more information about a command.
compare
$ semver compare 1.0.0 1.0.0-alpha.1
1
filter
$ semver filter 1.0.0 1.0 v1.0.0 1.0.0-alpha.1
1.0.0
1.0.0-alpha.1
$ semver format 'v{{.Major}}.{{.Minor}}.{{.Patch}}' 1.0.0-alpha+001
v1.0.0
next major/minor/patch
$ semver next major 1.0.0-alpha+001
1.0.0
sort
$ semver sort 1.1.1 1.0.0 1.0.1
1.0.0
1.0.1
1.1.1
validate
$ semver validate 1.0.0-alpha+001
$ echo $?
0
version
$ semver version
semver version 1.0.0
commit: 224394b9d709277fe5e4965a6633535c597cd2ed
built at: 2020-06-18T20:22:25Z
License
This project is licensed under the MIT License.