From 2000747176312a84e432f93f362eb0e33581bbd4 Mon Sep 17 00:00:00 2001 From: "Jip J. Dekker" Date: Thu, 17 Mar 2016 17:46:37 +0100 Subject: [PATCH] Use helper for logging command error --- cmd/root.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 2acb72f..411bc18 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -15,9 +15,7 @@ package cmd import ( - "fmt" - "os" - + "github.com/jjdekker/ponder/helpers" "github.com/spf13/cobra" ) @@ -37,10 +35,8 @@ other PDF files to be part of your song book.`, // Execute adds all child commands to the root command sets flags appropriately. // This is called by main.main(). It only needs to happen once to the rootCmd. func Execute() { - if err := RootCmd.Execute(); err != nil { - fmt.Println(err) - os.Exit(-1) - } + err := RootCmd.Execute() + helpers.Check(err, "Command returned an error") } func init() {