Skip to content
/ calver Public

calver is a package/tool provides the ability to work with Calendar Versioning in Go.

License

Notifications You must be signed in to change notification settings

k1LoW/calver

Repository files navigation

calver CI Go Reference Coverage Code to Test Ratio

calver is a package/tool provides the ability to work with Calendar Versioning in Go.

Usage

As a package

package main

import (
	"fmt"

	"github.com/k1LoW/calver"
)

func main() {
	cv, _ := calver.Parse("YY.0M.MICRO", "23.05.1")
	fmt.Println(cv) // Output: 23.05.1
	ncv, _ := cv.Next()
	fmt.Println(ncv) // Output: 23.05.2
}

As a tool

$ date
Tue May  9 13:04:09 UTC 2023
$ calver --layout YY.0M.MICRO
23.5.0
$ calver --layout YY.0M.MICRO | calver --layout YY.0M.MICRO --next
23.5.1

Example: Generate version like Ubuntu

$ date
Tue May  9 13:04:09 UTC 2023
$ calver --layout YY.0M.MICRO --trim-suffix
2023.05
$ calver --layout YY.0M.MICRO --trim-suffix | calver --layout YY.0M.MICRO --trim-suffix --next
2023.05.1

Example: Use modifier

$ date
Tue May  9 13:04:09 UTC 2023
$ calver --layout YY.0M.MICRO-MODIFIER --trim-suffix --modifier dev
2023.05-dev
$ calver 23.05-dev --layout YY.0M.MICRO-MODIFIER --trim-suffix --next
2023.05
$ calver 23.05 --layout YY.0M.MICRO-MODIFIER --trim-suffix --next
2023.05.1

Example: Get latest version and generate next version

$ date
Tue May  9 13:04:09 UTC 2023
$ gh release list | cut -f 1
v1.1.2
v1.1.1
2023.05.1
2023.05.0
v1.1.0
v1.0.1
2023.03.1
2023.03.0
v1.0.0
2023.02.0
v0.1.0
$ gh release list | cut -f 1 | calver --layout YY.0M.MICRO
2023.05.1
$ gh release list | cut -f 1 | calver --layout YY.0M.MICRO --next
2023.05.2

Install

As a package

$ go get github.com/k1LoW/calver

As a tool

deb:

$ export CALVER_VERSION=X.X.X
$ curl -o calver.deb -L https://github.com/k1LoW/calver/releases/download/v$CALVER_VERSION/calver_$CALVER_VERSION-1_amd64.deb
$ dpkg -i calver.deb

RPM:

$ export CALVER_VERSION=X.X.X
$ yum install https://github.com/k1LoW/calver/releases/download/v$CALVER_VERSION/calver_$CALVER_VERSION-1_amd64.rpm

apk:

$ export CALVER_VERSION=X.X.X
$ curl -o calver.apk -L https://github.com/k1LoW/calver/releases/download/v$CALVER_VERSION/calver_$CALVER_VERSION-1_amd64.apk
$ apk add calver.apk

homebrew tap:

$ brew install k1LoW/tap/calver

manually:

Download binary from releases page

go install:

$ go install github.com/k1LoW/calver/cmd/calver@latest

About

calver is a package/tool provides the ability to work with Calendar Versioning in Go.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published