Files
snitch/cmd/version.go
2025-12-16 22:52:07 +01:00

31 lines
552 B
Go

package cmd
import (
"fmt"
"runtime"
"github.com/spf13/cobra"
)
var (
Version = "dev"
Commit = "none"
Date = "unknown"
)
var versionCmd = &cobra.Command{
Use: "version",
Short: "Show version/build info",
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("snitch %s\n", Version)
fmt.Printf(" commit: %s\n", Commit)
fmt.Printf(" built: %s\n", Date)
fmt.Printf(" go: %s\n", runtime.Version())
fmt.Printf(" os: %s/%s\n", runtime.GOOS, runtime.GOARCH)
},
}
func init() {
rootCmd.AddCommand(versionCmd)
}