Skip to content

ffurrer2/semver

Repository files navigation

SemVer

CI MIT License Go Version Go Report Card GitHub Release

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

Build from source

go install github.com/ffurrer2/semver/v2/cmd/semver@latest

Usage

help

$ semver help
The semantic version utility

Usage:
  semver [command]

Available Commands:
  compare     Compare semantic versions
  completion  Generate the autocompletion script for the specified shell
  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

format

$ 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.8.0
git commit:     10c573e1ec0a6aa302c6ace2d995793139ebc1e6
git tree state: clean

License

This project is licensed under the MIT License.