Add --version / version with baked-in git commit
ldflags inject version, commit, and build date; a version subcommand also reports go version and platform. Ends the which-binary-is-this guessing after deploys. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"runtime"
|
||||
"sort"
|
||||
"syscall"
|
||||
"text/tabwriter"
|
||||
@@ -17,6 +18,21 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// versionCmd prints detailed build and runtime info.
|
||||
func versionCmd() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Print version, git commit, and build info",
|
||||
Run: func(cmd *cobra.Command, _ []string) {
|
||||
fmt.Printf("rtsp-streamer %s\n", version)
|
||||
fmt.Printf(" commit: %s\n", commit)
|
||||
fmt.Printf(" built: %s\n", date)
|
||||
fmt.Printf(" go: %s\n", runtime.Version())
|
||||
fmt.Printf(" platform: %s/%s\n", runtime.GOOS, runtime.GOARCH)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// daemonCmd runs the video wall. This is what systemd (via sway) launches.
|
||||
func daemonCmd() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
|
||||
Reference in New Issue
Block a user