From b88dc06efc6b1f87dff897184044b872a0540186 Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Wed, 17 Sep 2025 12:59:46 +0200 Subject: [PATCH] fix: properly log version --- internal/cli/root.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/cli/root.go b/internal/cli/root.go index ff899b1..567f9fd 100644 --- a/internal/cli/root.go +++ b/internal/cli/root.go @@ -9,14 +9,16 @@ import ( // rootCmd represents the base command when called without any subcommands var rootCmd = &cobra.Command{ - Use: "readium", - Short: "Utilities for Readium Web Publications", - Version: Version + " (go-toolkit " + version.Version + ")", + Use: "readium", + Short: "Utilities for Readium Web Publications", } // Execute adds all child commands to the root command and sets flags appropriately. // This is called by main.main(). It only needs to happen once to the rootCmd. func Execute() { + if rootCmd.Version == "" { + rootCmd.Version = Version + " (go-toolkit " + version.Version + ")" + } err := rootCmd.Execute() if err != nil { // Error is already printed to stderr by Cobra.