package cli import ( "fmt" "runtime" "github.com/spf13/cobra" "sneak.berlin/go/vaultik/internal/globals" ) // NewVersionCommand creates the version command func NewVersionCommand() *cobra.Command { cmd := &cobra.Command{ Use: "version", Short: "Print version information", Long: `Print version, git commit, and build information for vaultik.`, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { fmt.Printf("vaultik %s\n", globals.Version) fmt.Printf(" commit: %s\n", globals.Commit) fmt.Printf(" build date: %s\n", globals.CommitDate) fmt.Printf(" go: %s\n", runtime.Version()) fmt.Printf(" os/arch: %s/%s\n", runtime.GOOS, runtime.GOARCH) fmt.Printf(" author: %s\n", globals.Author) fmt.Printf(" homepage: %s\n", globals.Homepage) fmt.Printf(" license: %s\n", globals.License) if globals.Version == "dev" { fmt.Println() fmt.Println("This is a development build (no version information embedded).") fmt.Println("Build a release binary with 'make vaultik' or download from") fmt.Println("https://sneak.berlin/go/vaultik for embedded version metadata.") } }, } return cmd }