Skip to content

Commit

Permalink
Merge pull request #97 from clcollins/fix_version_string
Browse files Browse the repository at this point in the history
Adds release version to output of `osdctl --version`
  • Loading branch information
openshift-merge-robot authored Jun 24, 2021
2 parents f41494d + 64b9e88 commit 1a90f0d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ builds:
goarch:
- amd64
ldflags:
- -s -w -X 'github.com/openshift/osdctl/cmd.GitCommit={{.ShortCommit}}'
- -s -w -X github.com/openshift/osdctl/cmd.GitCommit={{.ShortCommit}} -X github.com/openshift/osdctl/cmd.Version={{.Version}}

archives:
- replacements:
Expand Down
6 changes: 5 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"flag"
"fmt"
"os"

routev1 "github.com/openshift/api/route/v1"
Expand All @@ -26,6 +27,9 @@ import (
// GitCommit is the short git commit hash from the environment
var GitCommit string

// Version is the tag version from the environment
var Version string

func init() {
_ = awsv1alpha1.AddToScheme(scheme.Scheme)
_ = routev1.AddToScheme(scheme.Scheme)
Expand All @@ -38,7 +42,7 @@ func init() {
func NewCmdRoot(streams genericclioptions.IOStreams) *cobra.Command {
rootCmd := &cobra.Command{
Use: "osdctl",
Version: GitCommit,
Version: fmt.Sprintf("%s, GitCommit: %s", Version, GitCommit),
Short: "OSD CLI",
Long: `CLI tool to provide OSD related utilities`,
DisableAutoGenTag: true,
Expand Down

0 comments on commit 1a90f0d

Please sign in to comment.