= semver
`semver`; a tool to increment / compare your semantic versions
This tool is simply a wrapper around the https://github.com/Masterminds/semver[SemVer] library from https://github.com/Masterminds[Masterminds]. All credits go to them for writing the library.
== Installation
[source,bash]
----
go install github.com/huguesalary/semver
----
== Usage
[source]
----
Usage: ./semver [flags] version [version]
if [version] is passed, the command will compare version to [version] and
output -1, 0, or 1 if version is lower, equal or greater than [version]
*after* the application of major, minor, patch, prerelease and metadata
flags
-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
[source,bash]
----
semver 1.0.0
1.0.0
----
=== Output version with Increased Major
[source,bash]
----
semver -major 1 1.0.0
2.0.0
----
=== Output version with Increased Minor
[source,bash]
----
semver -minor 1 1.0.0
1.1.0
----
=== Output version with Increased Patch 3 times
[source,bash]
----
semver -patch 3 1.0.0
1.0.3
----
=== Output version with Increased Major, Minor and Patch
[source,bash]
----
semver -major 1 -minor 1 -patch 1 1.0.0
2.1.1
----
=== Output comparison between 2 _equal_ versions
[source,bash]
----
semver 1.0.0 1.0.0
1.0.0
0
----
=== Output comparison between 2 versions: first version is smaller than second
[source,bash]
----
semver 1.0.0 2.0.0
1.0.0
-1
----
=== Output comparison between 2 versions: first version is greater than second
[source,bash]
----
semver 1.0.0 0.0.9
1.0.0
1
----