2018-06-02 01:00:54 +02:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
2019-02-28 16:24:29 +01:00
|
|
|
"github.com/bdlm/log"
|
2018-06-02 01:00:54 +02:00
|
|
|
|
|
|
|
"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")
|
|
|
|
}
|