func main() {
	config := &mungeConfig{}
	root := &cobra.Command{
		Use:   filepath.Base(os.Args[0]),
		Short: "A program to add labels, check tests, and generally mess with outstanding PRs",
		RunE: func(_ *cobra.Command, _ []string) error {
			if err := config.PreExecute(); err != nil {
				return err
			}
			if len(config.PRMungersList) == 0 {
				glog.Fatalf("must include at least one --pr-mungers")
			}
			mungers.InitializeMungers(config.PRMungersList, &config.Config)
			return doMungers(config)
		},
	}
	root.SetGlobalNormalizationFunc(util.WordSepNormalizeFunc)
	config.AddRootFlags(root)
	addMungeFlags(config, root)

	allMungers := mungers.GetAllMungers()
	for _, m := range allMungers {
		m.AddFlags(root, &config.Config)
	}

	if err := root.Execute(); err != nil {
		glog.Fatalf("%v\n", err)
	}
}
func main() {
	config := &mungeConfig{}
	root := &cobra.Command{
		Use:   filepath.Base(os.Args[0]),
		Short: "A program to add labels, check tests, and generally mess with outstanding PRs",
		RunE: func(_ *cobra.Command, _ []string) error {
			glog.Info(mungerutil.PrettyString(config))
			if err := config.PreExecute(); err != nil {
				return err
			}
			if len(config.IssueReportsList) > 0 {
				return reports.RunReports(&config.Config, config.IssueReportsList...)
			}
			if len(config.PRMungersList) == 0 {
				glog.Fatalf("must include at least one --pr-mungers")
			}
			if err := mungers.RegisterMungers(config.PRMungersList); err != nil {
				glog.Fatalf("unable to find requested mungers: %v", err)
			}
			requestedFeatures := mungers.RequestedFeatures()
			if err := config.Features.Initialize(&config.Config, requestedFeatures); err != nil {
				return err
			}
			if err := mungers.InitializeMungers(&config.Config, &config.Features); err != nil {
				glog.Fatalf("unable to initialize mungers: %v", err)
			}
			return doMungers(config)
		},
	}
	root.SetGlobalNormalizationFunc(utilflag.WordSepNormalizeFunc)
	config.AddRootFlags(root)
	addMungeFlags(config, root)
	config.Features.AddFlags(root)

	allMungers := mungers.GetAllMungers()
	for _, m := range allMungers {
		m.AddFlags(root, &config.Config)
	}

	allReports := reports.GetAllReports()
	for _, r := range allReports {
		r.AddFlags(root, &config.Config)
	}

	if err := root.Execute(); err != nil {
		glog.Fatalf("%v\n", err)
	}
}