semverfmt is a utility to parse and reformat semantic versions. Semantic versions can be reformatted using printf style specifications.
Download the latest release from https://github.com/jakewarren/semverfmt/releases/latest
go get github.com/jakewarren/semverfmt/...
❯ semverfmt -h
Usage: semverfmt [flags] <format string>
Flags:
-g, --git string directory path to query tag via git. use '.' to specify to current directory
-h, --help display help
-V, --version display version information
Examples:
- Read from stdin:
echo "v1.2.3" | semverfmt v%M.%m
- Read version info from git tags:
semverfmt --git ~/path/to/foo "v%M"
Format string specification:
| Format | Description |
|---|---|
| %M | Major version |
| %m | Minor version |
| %p | Patch version |
❯ echo "v1.2.3" | semverfmt v%M.%m
v1.2
semverfmt can also query git directly to get a tag.
❯ semverfmt --git ~/golang/src/github.com/jakewarren/fixme "v%M"
v1
All notable changes to this project will be documented in the changelog.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
MIT © 2019 Jake Warren