Report error on command parsing

This commit is contained in:
Andreas Schneider 2018-04-06 19:19:45 +02:00
parent 58238a4e39
commit dc9594c3f8
1 changed files with 6 additions and 1 deletions

View File

@ -1,8 +1,10 @@
package main package main
import ( import (
"fmt"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"log" "log"
"os"
"time" "time"
) )
@ -13,7 +15,10 @@ func main() {
Run: runSynchronization, Run: runSynchronization,
} }
rootCmd.Execute() if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
} }
func runSynchronization(cmd *cobra.Command, args []string) { func runSynchronization(cmd *cobra.Command, args []string) {