Skip to content

Commit c957bc1

Browse files
authored
Merge pull request #12 from overmindtech/add-version
Add CLI version
2 parents 5714b3f + 1caa73c commit c957bc1

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ go.work
2222

2323
dist/
2424
tracing/commit.txt
25+
cmd/commit.txt

cmd/root.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cmd
22

33
import (
44
"context"
5+
_ "embed"
56
"errors"
67
"fmt"
78
"net/http"
@@ -27,11 +28,16 @@ var logLevel string
2728

2829
var minStatusInterval = durationpb.New(250 * time.Millisecond)
2930

31+
//go:generate sh -c "echo -n $(git describe --long) > commit.txt"
32+
//go:embed commit.txt
33+
var cliVersion string
34+
3035
// rootCmd represents the base command when called without any subcommands
3136
var rootCmd = &cobra.Command{
32-
Use: "ovm-cli",
33-
Short: "A CLI to interact with the overmind API",
34-
Long: `The ovm-cli allows direct access to the overmind API`,
37+
Use: "ovm-cli",
38+
Short: "A CLI to interact with the overmind API",
39+
Long: `The ovm-cli allows direct access to the overmind API`,
40+
Version: cliVersion,
3541
PreRun: func(cmd *cobra.Command, args []string) {
3642
// Bind these to viper
3743
err := viper.BindPFlags(cmd.Flags())

0 commit comments

Comments
 (0)