Home

Awesome

import "go.szostok.io/version"

Go package to present your CLI version in a classy way. All magic included!

Like the idea? Give a GitHub star ⭐!

Quick Start

go get go.szostok.io/version

Visit version.szostok.io/quick-start for the most popular way of the setup.

Documentation

Visit version.szostok.io for complete documentation about setup and usage.

Why?

If you create a new CLI, it's natural that you use a framework such as Cobra, urfave/cli, or similar. Each of your CLIs has also an option to show its version. But in this case, we repeat the same stuff: collecting and displaying related information.

This package aims to solve that problem. To register the version command, simply add:

extension.NewVersionCobraCmd()

Go 1.18 simplified collecting version-related data, as commit, date, and other data are embedded. You can still override these fields with ldflags, e.g.:

-X go.szostok.io/version.version=1.42.0

You can gain more features, such as upgrade notice, just by adding:

extension.WithUpgradeNotice("repo-owner", "repo-name")

Functionality

<!--- - Autodiscover installation method --->

<img src="./docs/assets/bell-icon.png" /> Stay informed

Follow @m_szostok on Twitter to get the latest news. You can also subscribe for new version releases on GitHub, where you can find a detailed changelog for each of them.

For additional content, check Mateusz Szostok's blog.