mirror of
https://github.com/Belphemur/CBZOptimizer.git
synced 2025-10-14 12:38:50 +02:00
fix: get proper version
This commit is contained in:
@@ -36,7 +36,7 @@ builds:
|
|||||||
# trims path
|
# trims path
|
||||||
- -trimpath
|
- -trimpath
|
||||||
ldflags:
|
ldflags:
|
||||||
- -s -w -X meta.Version={{.Version}} -X meta.Commit={{.Commit}} -X meta.Date={{ .CommitDate }}
|
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X meta.date={{ .CommitDate }}
|
||||||
env:
|
env:
|
||||||
- CGO_ENABLED=0
|
- CGO_ENABLED=0
|
||||||
# config the checksum filename
|
# config the checksum filename
|
||||||
|
@@ -14,6 +14,10 @@ var rootCmd = &cobra.Command{
|
|||||||
Short: "Convert CBZ files using a specified converter",
|
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 {
|
func getPath() string {
|
||||||
return filepath.Join(map[string]string{
|
return filepath.Join(map[string]string{
|
||||||
"windows": filepath.Join(os.Getenv("APPDATA")),
|
"windows": filepath.Join(os.Getenv("APPDATA")),
|
||||||
|
@@ -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)
|
|
||||||
}
|
|
Reference in New Issue
Block a user