diff --git a/cmd/root.go b/cmd/root.go index 35ca96b..4da3778 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -5,7 +5,7 @@ Copyright © 2023 Seednode package cmd import ( - "log" + "fmt" "os" "github.com/spf13/cobra" @@ -24,11 +24,13 @@ var ( Use: "roulette [path]...", Short: "Serves random images from the specified directories.", Args: cobra.MinimumNArgs(1), - Run: func(cmd *cobra.Command, args []string) { + RunE: func(cmd *cobra.Command, args []string) error { err := ServePage(args) if err != nil { - log.Fatal(err) + return err } + + return nil }, } ) @@ -36,6 +38,7 @@ var ( func Execute() { err := rootCmd.Execute() if err != nil { + fmt.Println(err) os.Exit(1) } } diff --git a/cmd/version.go b/cmd/version.go index 5eb1301..dafe543 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -10,7 +10,7 @@ import ( "github.com/spf13/cobra" ) -var Version = "0.34.1" +var Version = "0.34.2" func init() { rootCmd.AddCommand(versionCmd)