package main import ( "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) var rootCmd = &cobra.Command{ Use: "guerrillad", Short: "small SMTP daemon", Long: `It's a small SMTP daemon written in Go, for the purpose of receiving large volumes of email. Written for GuerrillaMail.com which processes tens of thousands of emails every hour.`, Run: nil, } var ( verbose bool ) func init() { cobra.OnInitialize() rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "print out more debug information") rootCmd.PersistentPreRun = func(cmd *cobra.Command, args []string) { if verbose { logrus.SetLevel(logrus.DebugLevel) } else { logrus.SetLevel(logrus.InfoLevel) } } }