huguesalary / semver

`semver`; a tool to increment your semantic version

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

semver

semver; a tool to increment / compare your semantic versions

This tool is simply a wrapper around the SemVer library from Masterminds. All credits go to them for writing the library.

Installation

go install github.com/huguesalary/semver

Usage

Usage: ./semver [flags] version [version]
      If [version] is provided, the command will output the whether version is lower (-1),
      equal (0), or greater (1) than [version] after the applying the major, minor, patch,
      prerelease and metadata transformations to version

  -major int
      increase major by n
  -metadata string
        set metadata
  -minor int
        increase minor by n
  -patch int
        increase patch by n
  -prerelease string
        set prerelease
  -version
        output this tool's version

Examples

Just output the version

$ semver 1.0.0
1.0.0

Output version with incremented Major

$ semver -major 1 1.0.0
2.0.0

Output version with incremented Minor

$ semver -minor 1 1.0.0
1.1.0

Output version with incremented Patch 3 times

$ semver -patch 3 1.0.0
1.0.3

Output version with incremented Major, Minor and Patch

$ semver -major 1 -minor 1 -patch 1 1.0.0
2.1.1

Output version with incremented Major, Minor and Patch; + Prerelease and Metadata information

$ semver -major 1 -minor 1 -patch 1 -prerelease rc1 -metadata buildx 1.0.0
2.1.1-rc1+buildx

Output comparison between 2 equal versions

$ semver 1.0.0 1.0.0
0

Output comparison between 2 versions: first version is smaller than second

$ semver 1.0.0 2.0.0
-1

Output comparison between 2 versions: first version is greater than second

$ semver 1.0.0 0.0.9
1

Output comparison between 2 versions: first version is greater than second, after applying all transformations

$ semver -major 1 -minor 2 -patch 3 1.0.0 2.2.2
1

(2.2.3 is > 2.2.2)

About

`semver`; a tool to increment your semantic version

License:MIT License


Languages

Language:Go 100.0%