Embeds the git short hash and UTC build timestamp into both binaries via ldflags so it's easy to confirm which build is actually deployed, without needing to hand-maintain a version number. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
25 lines
496 B
Go
25 lines
496 B
Go
/*
|
|
Copyright © 2024 NAME HERE <EMAIL ADDRESS>
|
|
*/
|
|
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/hculpan/areweplaying/pkg/version"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
// versionCmd represents the version command
|
|
var versionCmd = &cobra.Command{
|
|
Use: "version",
|
|
Short: "Print the build version and time",
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
fmt.Printf("awp-cli %s (built %s)\n", version.Version, version.BuildTime)
|
|
return nil
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(versionCmd)
|
|
}
|