Use helper for logging command error
This commit is contained in:
parent
310ebb319f
commit
2000747176
10
cmd/root.go
10
cmd/root.go
@ -15,9 +15,7 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"github.com/jjdekker/ponder/helpers"
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"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.
|
// 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.
|
// This is called by main.main(). It only needs to happen once to the rootCmd.
|
||||||
func Execute() {
|
func Execute() {
|
||||||
if err := RootCmd.Execute(); err != nil {
|
err := RootCmd.Execute()
|
||||||
fmt.Println(err)
|
helpers.Check(err, "Command returned an error")
|
||||||
os.Exit(-1)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
Reference in New Issue
Block a user