forked from flashmob/go-guerrilla
-
Notifications
You must be signed in to change notification settings - Fork 0
/
root.go
31 lines (27 loc) · 712 Bytes
/
root.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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)
}
}
}