ProductPromotion
Logo

Go.Lang

made by https://0x3d.site

GitHub - mszostok/version: 🧬 Pure DNA of your CLI!
🧬 Pure DNA of your CLI! Contribute to mszostok/version development by creating an account on GitHub.
Visit Site

GitHub - mszostok/version: 🧬 Pure DNA of your CLI!

GitHub - mszostok/version: 🧬 Pure DNA of your CLI!

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

  • For Go 1.18+, detect version, commit, commitDate, and dirtyBuild automatically
    • Allow version data overriding via -ldflags
  • Print the version in the YAML, JSON, short, and pretty formats
  • Detect and display an upgrade notice if a newer version of your project has been released
  • Automatically disable color output for non-tty output streams
    • Handle the version and upgrade notices separately
  • Designed in a way that lets you use each component individually
  • Everything can be enabled with a single line of code. For example, use extension.NewVersionCobraCmd() to enable the version command for Cobra
  • Customize the output format and behaviour (e.g. timeouts, re-check intervals)
  • Parse any dates and print them in the local date and time format
  • All provided functionality is fully tested to ensure no regression
  • Extend the version info with own fields just by assigning your Go struct

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.

Articles
to learn more about the golang concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about GoLang.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory