Fix prerun

This commit is contained in:
Daniel 2024-11-13 19:58:49 -05:00
parent 45eb4c9f3e
commit 9ad1ed17c2
2 changed files with 4 additions and 1 deletions

View file

@ -44,3 +44,6 @@ backupplain:
test:
go test -v ./...
run:
go run -v ./cmd/stillbox/ serve

View file

@ -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())