wifictld-analyzer/cmd/root.go

34 lines
755 B
Go
Raw Normal View History

2018-06-02 01:00:54 +02:00
package cmd
import (
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
var debug bool
// RootCmd represents the base command when called without any subcommands
var RootCmd = &cobra.Command{
Use: "analyzer",
Short: "wifictld analyzer",
Long: `capture wifictld traffic and display thus`,
}
// 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() {
if err := RootCmd.Execute(); err != nil {
log.Error(err)
}
}
func init() {
cobra.OnInitialize(func() {
if debug {
log.SetLevel(log.DebugLevel)
}
log.Debug("show debug")
})
RootCmd.PersistentFlags().BoolVar(&debug, "v", false, "show debug log")
}