diff --git a/cmd/root.go b/cmd/root.go index a0f1706..1ff55d1 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -38,5 +38,6 @@ func initRootCmd() { logger := jlog.New(slog.LevelDebug) ctx := jlog.ContextWith(context.Background(), logger) + rootCmd.AddCommand(&versionCmd) rootCmd.AddCommand(getVerbs(ctx, &appConfig)...) } diff --git a/cmd/version.go b/cmd/version.go new file mode 100644 index 0000000..92f9ddf --- /dev/null +++ b/cmd/version.go @@ -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) + }, +} diff --git a/util/version.go b/util/version.go new file mode 100644 index 0000000..ef48573 --- /dev/null +++ b/util/version.go @@ -0,0 +1,3 @@ +package util + +const AppVersion = "v0.1"