Skip to content

Commit

Permalink
feat: bump initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
alexppg committed Jun 28, 2021
1 parent 5551698 commit bf4919d
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/coverage.out
/bin/
dist/
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

31 changes: 31 additions & 0 deletions cmd/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package cmd

import (
"fmt"

"github.com/spf13/cobra"
goVersion "go.hein.dev/go-version"
)

var (
shortened = false
version = "dev"
commit = "none"
date = "unknown"
output = "json"
versionCmd = &cobra.Command{
Use: "version",
Short: "Outputs the current build information",
Long: ``,
Run: func(_ *cobra.Command, _ []string) {
resp := goVersion.FuncWithOutput(shortened, version, commit, date, output)
fmt.Print(resp)
},
}
)

func init() {
versionCmd.Flags().BoolVar(&shortened, "short", false, "Print just the version number.")
versionCmd.Flags().StringVar(&output, "output", "yaml", "Output format. One of 'yaml' or 'json'.")
rootCmd.AddCommand(versionCmd)
}

0 comments on commit bf4919d

Please sign in to comment.