From 9ad1ed17c29f1b20610ceae2e8304a5f4fa097ab Mon Sep 17 00:00:00 2001 From: Daniel Ponte Date: Wed, 13 Nov 2024 19:58:49 -0500 Subject: [PATCH] Fix prerun --- Makefile | 3 +++ cmd/stillbox/main.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 997e842..675cd29 100644 --- a/Makefile +++ b/Makefile @@ -44,3 +44,6 @@ backupplain: test: go test -v ./... + +run: + go run -v ./cmd/stillbox/ serve diff --git a/cmd/stillbox/main.go b/cmd/stillbox/main.go index b78b84e..95e8284 100644 --- a/cmd/stillbox/main.go +++ b/cmd/stillbox/main.go @@ -24,7 +24,7 @@ func main() { } rootCmd.PersistentFlags().BoolP("version", "V", false, "show version") cfg := config.New(rootCmd) - rootCmd.Run = func(cmd *cobra.Command, args []string) { + rootCmd.PreRun = func(cmd *cobra.Command, args []string) { v, _ := rootCmd.PersistentFlags().GetBool("version") if v { fmt.Print(version.String())