semver

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EmptyErr          = errors.New("Empty string cannot be a version")
	NoVErr            = errors.New("No 'v' at start of the version")
	NoMinorOrPatchErr = errors.New("No minor or patch parts of version")
)
View Source
var Tool = mtool.T("semver").Func(func(f *mtool.Flags) {
	args := f.Parse()
	if len(args) != 1 {
		f.Usage()
		return
	}

	v, err := ParseVersion(args[0])
	if err != nil {
		log.Fatalf("error: parsing: %s", err)
		return
	}
	fmt.Printf(
		"%d\n%d\n%d\n%s\n%s\n",
		v.Major, v.Minor, v.Patch, v.DetailDelimiter, v.Detail,
	)
}).Desc(
	"get different parts of the version in the SemVer format",
).Usage(
	"<version>",
)

Functions

This section is empty.

Types

type Version

type Version struct {
	Major           int64
	Minor           int64
	Patch           int64
	DetailDelimiter string
	Detail          string
}

func ParseVersion

func ParseVersion(version string) (Version, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL