Skip to content

Commit

Permalink
feat: add version number
Browse files Browse the repository at this point in the history
  • Loading branch information
katallaxie authored Jan 7, 2025
1 parent 76d1b69 commit 8ae3610
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"context"
"fmt"
"os"
"os/exec"
"path/filepath"
Expand All @@ -15,6 +16,16 @@ import (

var config = cfg.Default()

const (
versionFmt = "%s (%s %s)"
)

var (
version = "dev"
commit = "none"
date = "unknown"
)

func init() {
RootCmd.AddCommand(InitCmd)
RootCmd.AddCommand(ValidateCmd)
Expand All @@ -36,6 +47,7 @@ var RootCmd = &cobra.Command{
RunE: func(cmd *cobra.Command, args []string) error {
return runRoot(cmd.Context())
},
Version: fmt.Sprintf(versionFmt, version, commit, date),
}

func runRoot(ctx context.Context) error {
Expand Down

0 comments on commit 8ae3610

Please sign in to comment.