Exit code 1 on error
package cmd
import (
+ "os"
+
"github.com/spf13/cobra"
)
@@ -22,7 +24,9 @@ func firstOrEmpty(list []string) string {
// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
- rootCmd.Execute()
+ if err := rootCmd.Execute(); err != nil {
+ os.Exit(1)
+ }
}
func init() {
