feat: version command

This commit is contained in:
2025-07-21 01:11:52 +02:00
parent 90a5125c66
commit 84b197fcb4
3 changed files with 20 additions and 0 deletions

View File

@ -38,5 +38,6 @@ func initRootCmd() {
logger := jlog.New(slog.LevelDebug) logger := jlog.New(slog.LevelDebug)
ctx := jlog.ContextWith(context.Background(), logger) ctx := jlog.ContextWith(context.Background(), logger)
rootCmd.AddCommand(&versionCmd)
rootCmd.AddCommand(getVerbs(ctx, &appConfig)...) rootCmd.AddCommand(getVerbs(ctx, &appConfig)...)
} }

16
cmd/version.go Normal file
View File

@ -0,0 +1,16 @@
package cmd
import (
"fmt"
"git.bissendorf.co/bissendorf/unifood/m/v2/util"
"github.com/spf13/cobra"
)
var versionCmd = cobra.Command{
Use: "version",
Aliases: []string{"v"},
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(util.AppVersion)
},
}

3
util/version.go Normal file
View File

@ -0,0 +1,3 @@
package util
const AppVersion = "v0.1"