Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andreygrechin/gosemver
A command-line tool for semantic version manipulation that follows Semantic Versioning 2.0.0 specification.
https://github.com/andreygrechin/gosemver
ci cicd cli golang semver versioning
Last synced: 1 day ago
JSON representation
A command-line tool for semantic version manipulation that follows Semantic Versioning 2.0.0 specification.
- Host: GitHub
- URL: https://github.com/andreygrechin/gosemver
- Owner: andreygrechin
- License: mit
- Created: 2025-01-03T22:44:09.000Z (5 days ago)
- Default Branch: main
- Last Pushed: 2025-01-05T21:10:02.000Z (3 days ago)
- Last Synced: 2025-01-05T22:18:39.679Z (3 days ago)
- Topics: ci, cicd, cli, golang, semver, versioning
- Language: Go
- Homepage: https://semver.org
- Size: 57.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gosemver
A command-line tool for semantic version manipulation that follows
[Semantic Versioning 2.0.0](https://semver.org) specification.## Features
- Validate semantic versions
- Compare two versions
- Find differences between versions
- Extract version identifiers
- Bump version identifiers (major, minor, patch, prerelease)
- JSON output support## Installation
### go install
```shell
go install github.com/andreygrechin/gosemver@latest
```### Containers
```shell
$ docker run --rm ghcr.io/andreygrechin/gosemver:latest validate 1.2.3
valid
```### Manually
Download the pre-compiled binaries from
[the releases page](https://github.com/andreygrechin/gosemver/releases/) and copy them to a desired
location.## Usage
### Validate a Version
```shell
$ gosemver validate 1.2.3
valid$ gosemver validate v1.2.3-beta.1+build.123
valid$ gosemver validate 1.2
invalid # also returns exit code 1
```### Compare Versions
Compare two versions, outputs:
- `-1` if the first version is lower
- `0` if equal
- `1` if the first version is higher```shell
$ gosemver compare v1.0.0 v1.2.3
-1$ gosemver compare 1.0.0 1.0.0-alpha
1
```### Find Version Differences
Identify the most significant difference between versions:
```shell
$ gosemver diff v1.0.0 v1.1.0
minor
$ gosemver diff v1.0.0 v1.0.0-beta1
prerelease
```### Get Version Identifiers
Extract specific version identifiers:
```shell
$ gosemver get major 1.2.3
1$ gosemver get prerelease 1.2.3-beta.1
beta.1$ gosemver get build 1.2.3+build.123
build.123$ gosemver get release 1.2.3-beta.1+build.123
1.2.3$ gosemver get json 1.2.3-beta.1+build.123
{"major":1,"minor":2,"patch":3,"prerelease":"beta.1","build":"build.123","release":"1.2.3"}
```### Bump Version Identifiers
Increment version identifiers:
```shell
$ gosemver bump major 1.2.3
2.0.0$ gosemver bump prerelease 1.2.3 --prerelease-id beta
1.2.3-beta$ gosemver bump release 1.2.3-beta.1
1.2.3
```## License
MIT License - see [LICENSE](LICENSE) for details.
## Acknowledgments
This tool is inspired by [semver-tool](https://github.com/fsaintjacques/semver-tool) created by
François Saint-Jacques.