1package main 2 3import ( 4 "os" 5 6 "github.com/sensu/sensu-go/cli" 7 "github.com/sensu/sensu-go/cli/commands" 8 hooks "github.com/sensu/sensu-go/cli/commands/hooks" 9 "github.com/sensu/sensu-go/cli/commands/root" 10 "github.com/spf13/cobra" 11) 12 13func main() { 14 rootCmd := root.Command() 15 sensuCli := cli.New(rootCmd.PersistentFlags()) 16 17 rootCmd.PersistentPreRunE = func(cmd *cobra.Command, _ []string) error { 18 return hooks.ConfigurationPresent(cmd, sensuCli) 19 } 20 21 commands.AddCommands(rootCmd, sensuCli) 22 23 if err := rootCmd.Execute(); err != nil { 24 os.Exit(1) 25 } 26} 27