forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
root.go
31 lines (23 loc) · 776 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 cmd
import (
"flag"
"github.com/spf13/pflag"
// import protocol modules
_ "github.com/elastic/beats/packetbeat/include"
cmd "github.com/elastic/beats/libbeat/cmd"
"github.com/elastic/beats/packetbeat/beater"
)
// Name of this beat
var Name = "packetbeat"
// RootCmd to handle beats cli
var RootCmd *cmd.BeatsRootCmd
func init() {
var runFlags = pflag.NewFlagSet(Name, pflag.ExitOnError)
runFlags.AddGoFlag(flag.CommandLine.Lookup("I"))
runFlags.AddGoFlag(flag.CommandLine.Lookup("t"))
runFlags.AddGoFlag(flag.CommandLine.Lookup("O"))
runFlags.AddGoFlag(flag.CommandLine.Lookup("l"))
runFlags.AddGoFlag(flag.CommandLine.Lookup("dump"))
RootCmd = cmd.GenRootCmdWithRunFlags(Name, "", beater.New, runFlags)
RootCmd.AddCommand(genDevicesCommand())
}