fix: get proper version

This commit is contained in:
Antoine Aflalo
2024-08-27 20:22:22 -04:00
parent c8fe726a96
commit f451b660be
4 changed files with 12 additions and 22 deletions

View File

@@ -14,6 +14,10 @@ var rootCmd = &cobra.Command{
Short: "Convert CBZ files using a specified converter",
}
func SetVersionInfo(version, commit, date string) {
rootCmd.Version = fmt.Sprintf("%s (Built on %s from Git SHA %s)", version, date, commit)
}
func getPath() string {
return filepath.Join(map[string]string{
"windows": filepath.Join(os.Getenv("APPDATA")),

View File

@@ -1,21 +0,0 @@
package cmd
import (
"fmt"
"github.com/belphemur/CBZOptimizer/meta"
"github.com/spf13/cobra"
)
func init() {
command := &cobra.Command{
Use: "version",
Short: "Print the version of the application",
Long: "Print the version of the application",
Run: VersionCommand,
}
AddCommand(command)
}
func VersionCommand(_ *cobra.Command, _ []string) {
fmt.Printf("CBZOptimizer %s [%s] built [%s]\n", meta.Version, meta.Commit, meta.Date)
}